Podman : Use Dockerfile2023/06/21 |
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 debian MAINTAINER ServerWorld <admin@srv.world> RUN apt-get update RUN apt-get -y install nginx RUN echo "Dockerfile Test on Nginx" > /var/www/html/index.html EXPOSE 80 CMD ["/usr/sbin/nginx", "-g", "daemon off;"] # build image ⇒ podman build -t [image name]:[tag] . root@dlp:~# podman build -t srv.world/debian-nginx:latest . STEP 1/7: FROM debian STEP 2/7: MAINTAINER ServerWorld <admin@srv.world> --> 00970b06f91 STEP 3/7: RUN apt-get update ..... ..... COMMIT srv.world/debian-nginx:latest --> e2938e55cf7 Successfully tagged srv.world/debian-nginx:latest e2938e55cf7cbd06ac0c38b967476b4897f464ff74fc16f88cb4f0c30fe1895eroot@dlp:~# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/debian-nginx latest e2938e55cf7c About a minute ago 158 MB srv.world/debian-apache2 latest f047c6f28c56 8 minutes ago 260 MB docker.io/library/debian latest 49081a1edb0b 8 days ago 121 MB # run container root@dlp:~# podman run -d -p 80:80 srv.world/debian-nginx fd506a88790a2a0c3cdda70f3b5d9be3041b145a0df0bfcdd6d393cce319ca5croot@dlp:~# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fd506a88790a srv.world/debian-nginx:latest /usr/sbin/nginx -... 11 seconds ago Up 11 seconds ago 0.0.0.0:80->80/tcp festive_clarke # 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.11", "IPAddress": "10.88.0.11",root@dlp:~# curl 10.88.0.11 Dockerfile Test on Nginx |
The format of Dockerfile is [INSTRUCTION arguments] . Refer to the following description for INSTRUCTION.
|
Sponsored Link |