Podman : Use Dockerfile2025/11/12 |
|
Use Dockerfile and create Container images automatically. |
|
| [1] | For example, Create a Dockerfile that Nginx is installed and started. |
|
[root@dlp ~]#
vi Dockerfile # create new FROM fedora LABEL 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> --> bca13024dc95 STEP 3/6: RUN dnf -y install nginx ..... ..... Successfully tagged srv.world/fedora-nginx:latest 78a532c42789b92b08a0d3450ab09918ac9f78dfcbd5e0725c2dc243dc02fdd1[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/fedora-nginx latest 78a532c42789 37 seconds ago 346 MB srv.world/fedora-httpd latest 9681aa9061c7 7 minutes ago 349 MB registry.fedoraproject.org/fedora latest a9005aba99b1 2 days ago 186 MB # run container [root@dlp ~]# podman run -d -p 80:80 srv.world/fedora-nginx dde97be465c515ef6813ba70cf9fb6e1e4015b375013f8d7fa1faf01dcacb6b0[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES dde97be465c5 srv.world/fedora-nginx:latest /usr/sbin/nginx -... 16 seconds ago Up 17 seconds 0.0.0.0:80->80/tcp pedantic_wilson # 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 |
|
|