Podman : Use Dockerfile2023/04/26 |
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 fedora 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/fedora-nginx:latest . STEP 1/6: FROM fedora STEP 2/6: MAINTAINER ServerWorld <admin@srv.world> --> c58442ef01dd STEP 3/6: RUN dnf -y install nginx ..... ..... Successfully tagged srv.world/fedora-nginx:latest 97533117cdc8b313bf8111deff1ca483fdc82632e5451abe12160749c9b443c1[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/fedora-nginx latest 97533117cdc8 18 seconds ago 420 MB srv.world/fedora-httpd latest 51d32e13e2f4 6 minutes ago 477 MB registry.fedoraproject.org/fedora latest c9bfca6d0ac2 6 days ago 196 MB # run container [root@dlp ~]# podman run -d -p 80:80 srv.world/fedora-nginx bd054731f6829a78c9df98645881358b774e3ac55a3e99cce64ce76daab65ff5[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bd054731f682 srv.world/fedora-nginx:latest /usr/sbin/nginx -... 10 seconds ago Up 10 seconds 0.0.0.0:80->80/tcp keen_jemison # 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.10", "IPAddress": "10.88.0.10",[root@dlp ~]# curl 10.88.0.10 Dockerfile Test on Nginx |
The format of Dockerfile is [INSTRUCTION arguments] . Refer to the following description for INSTRUCTION.
|
Sponsored Link |
|