Podman : Use Dockerfile2020/11/06 |
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/nginx-server:latest . STEP 1: FROM fedora STEP 2: MAINTAINER ServerWorld <admin@srv.world> --> 0970f1d046f STEP 3: RUN dnf -y install nginx ..... ..... STEP 6: CMD ["/usr/sbin/nginx", "-g", "daemon off;"] STEP 7: COMMIT srv.world/nginx-server:latest --> 5c98ec35fda 5c98ec35fda656ff9245c41b89a95895a2b8649285399cce4ce0b29400d8f71f[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/nginx-server latest 5c98ec35fda6 39 seconds ago 419 MB srv.world/fedora-httpd latest 56430ecb044d 6 minutes ago 439 MB registry.fedoraproject.org/fedora latest 79fd58dc7611 8 days ago 181 MB # run container [root@dlp ~]# podman run -d -p 80:80 srv.world/nginx-server 8bbbebb255d6786081e666e5cc0318d3f9f28e1a78fb051ff05df747af2bb7d8[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8bbbebb255d6 srv.world/nginx-server:latest /usr/sbin/nginx -... 11 seconds ago Up 11 seconds ago 0.0.0.0:80->80/tcp dreamy_roentgen # 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",[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 |
|