Podman : Use Dockerfile2021/07/29 |
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 docker.io/rockylinux/rockylinux 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/rocky-nginx:latest . STEP 1: FROM docker.io/rockylinux/rockylinux STEP 2: MAINTAINER ServerWorld <admin@srv.world> --> 32cbb164a44 STEP 3: RUN dnf -y install nginx ..... ..... STEP 6: CMD ["/usr/sbin/nginx", "-g", "daemon off;"] STEP 7: COMMIT srv.world/rocky-nginx:latest --> 35c58055062 35c580550628a2e4e5633d59b6bec8a57423acc525b5eb8a8f3bb071898ea840[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/rocky-nginx latest 35c580550628 23 seconds ago 340 MB srv.world/rocky-httpd latest bb62279be7bd 9 minutes ago 342 MB docker.io/rockylinux/rockylinux latest 333da17614b6 5 weeks ago 234 MB # run container [root@dlp ~]# podman run -d -p 80:80 srv.world/rocky-nginx 5d6a1232d35ac7e365c7fa54dce45de688d1b60040db802d10bf3a98edee0a31[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5d6a1232d35a srv.world/rocky-nginx /usr/sbin/nginx -... 6 seconds ago Up 7 seconds ago 0.0.0.0:80->80/tcp goofy_wilbur # 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.8", "IPAddress": "10.88.0.8",[root@dlp ~]# curl 10.88.0.8 Dockerfile Test on Nginx |
The format of Dockerfile is [INSTRUCTION arguments] . Refer to the following description for INSTRUCTION.
|
Sponsored Link |