Podman : Use Dockerfile2024/11/06 |
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 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> --> 3caa69e6a0a2 STEP 3/6: RUN dnf -y install nginx ..... ..... Successfully tagged srv.world/fedora-nginx:latest cb2e14e1465e67ed5ec241c7bcae60123a5f87d2f98775fd2340e1dc81acf810[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/fedora-nginx latest cb2e14e1465e 32 seconds ago 316 MB srv.world/fedora-httpd latest 4dfbd95b4ef6 6 minutes ago 319 MB registry.fedoraproject.org/fedora latest 99519fcf3c1b 17 hours ago 163 MB # run container [root@dlp ~]# podman run -d -p 80:80 srv.world/fedora-nginx b363dc0de6731ea9b8e067584663ed7f102c3bfc55f2d1e31f64a574393f378e[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b363dc0de673 srv.world/fedora-nginx:latest /usr/sbin/nginx -... 14 seconds ago Up 15 seconds 0.0.0.0:80->80/tcp, 80/tcp goofy_shamir # 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 |