Podman : Use Dockerfile |
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 debian LABEL 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: LABEL Maintainer "ServerWorld <admin@srv.world>" --> b297213dbe62 STEP 3/7: RUN apt-get update ..... ..... COMMIT srv.world/debian-nginx:latest --> 33b7b5b10b13 Successfully tagged srv.world/debian-nginx:latest 33b7b5b10b139dea3a74317cc07172214360a6df956f4799b84dfb3e8b1b2cc0root@dlp:~# podman images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/debian-nginx latest 33b7b5b10b13 About a minute ago 157 MB srv.world/debian-apache2 latest a0aca892bf29 8 minutes ago 234 MB docker.io/library/debian latest 047bd8d81940 11 days ago 124 MB # run container root@dlp:~# podman run -d -p 80:80 srv.world/debian-nginx 05470306188d35c1a6367f585d5f8656c041fe88ca2ec50f2cc7db4588d23691root@dlp:~# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 05470306188d srv.world/debian-nginx:latest /usr/sbin/nginx -... 9 seconds ago Up 9 seconds 0.0.0.0:80->80/tcp exciting_noyce # 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.15",
"IPAddress": "10.88.0.15",
root@dlp:~# curl 10.88.0.15 Dockerfile Test on Nginx |
| The format of Dockerfile is [INSTRUCTION arguments] . Refer to the following description for INSTRUCTION.
|
No comments:
Post a Comment