Podman : Use Dockerfile2021/11/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 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> --> 5f89d07e9ca STEP 3/6: RUN dnf -y install nginx ..... ..... Successfully tagged srv.world/fedora-nginx:latest f27df6dc0cf8591ac8aa30acc4fce71c27747e624033925a1e09afc250022512[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/fedora-nginx latest f27df6dc0cf8 15 seconds ago 391 MB srv.world/fedora-httpd latest 3b282c5eda58 5 minutes ago 418 MB registry.fedoraproject.org/fedora latest 1b52edb08181 7 days ago 159 MB # run container [root@dlp ~]# podman run -d -p 80:80 srv.world/fedora-nginx 479e7e003edbe5f1a9c51eeac5d17cf78e40ea0c6e99a17604236e4ef76fab17[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 479e7e003edb srv.world/fedora-nginx:latest /usr/sbin/nginx -... 16 seconds ago Up 16 seconds ago 0.0.0.0:80->80/tcp angry_rubin # 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 |
|