Podman : Use Dockerfile2019/10/11 |
Use Dockerfile and create Container images automatically.
It is also useful for configuration management for Container Images. |
|
[1] | For example, Create a Dockerfile that Nginx is installed and started. |
[root@dlp ~]#
vi Dockerfile # create new FROM centos MAINTAINER ServerWorld <admin@srv.world> RUN dnf -y install nginx RUN echo "Dockerfile Test on Nginx" > /usr/share/nginx/html/index.html EXPOSE 80 CMD ["/usr/sbin/nginx", "-g", "daemon off;"] # build image ⇒ docker build -t [image name]:[tag] . [root@dlp ~]# podman build -t srv.world/nginx_server:latest . STEP 1: FROM centos STEP 2: MAINTAINER ServerWorld <admin@srv.world> --> 47a4ec064edb6846d07d909d9573bd935123bedbfec1fac891f7d334dce2abda STEP 3: FROM 47a4ec064edb6846d07d909d9573bd935123bedbfec1fac891f7d334dce2abda ..... ..... STEP 9: FROM f3afe7e61abc2366eff3da48755f775bdfa6e68180ce8525af391d4d99a200b7 STEP 10: CMD ["/usr/sbin/nginx", "-g", "daemon off;"] --> 41c48e1d242161269177ee5668af907ea7a6534a341b5eb489d62eaf767b7612 STEP 11: COMMIT srv.world/nginx_server:latest[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/nginx_server latest 41c48e1d2421 18 seconds ago 308 MB srv.world/centos_httpd latest 67edc4066f76 6 hours ago 368 MB docker.io/library/centos latest 0f3e07c0138f 8 days ago 227 MB # run container [root@dlp ~]# podman run -d -p 80:80 srv.world/nginx_server dd30cc06855ff3e496b2942471d3f2d102c5b7fda30752eafd208b947ae062cf[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES dd30cc06855f srv.world/nginx_server:latest /usr/sbin/nginx -... 17 seconds ago Up 16 seconds ago 0.0.0.0:80->80/tcp nostalgic_lamarr # verify accesses [root@dlp ~]# curl localhost Dockerfile Test on Nginx # also possible to access via container network [root@dlp ~]# podman inspect -l | grep \"IPAddress "IPAddress": "10.88.0.27",[root@dlp ~]# curl 10.88.0.27 Dockerfile Test on Nginx |
The format of Dockerfile is [INSTRUCTION arguments] . Refer to the following description for INSTRUCTION.
|
Sponsored Link |