Docker : Add Container images2023/06/22 |
Add Container images you created.
|
|
[1] | For example, update official image with installing Nginx and add it as a new image for container. The container is generated every time for executing docker run command, so add the latest executed container like follows. |
# show images root@dlp:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE debian latest 49081a1edb0b 9 days ago 116MB # start a Container and install nginx root@dlp:~# docker run debian /bin/bash -c "apt-get update; apt-get -y install nginx" docker ps -a | head -2 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 22d1b1ecdd1b debian "/bin/bash -c 'apt-g…" 13 seconds ago Exited (0) 1 second ago sharp_wilbur # add the image root@dlp:~# docker commit 22d1b1ecdd1b srv.world/debian-nginx sha256:5a202ab0ab76404d7a13a6c18980a79d9a6fcfd7ece88b393f1d44835f1c0c81root@dlp:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/debian-nginx latest 5a202ab0ab76 12 seconds ago 153MB debian latest 49081a1edb0b 9 days ago 116MB # generate a container from the new image and execute [which] to make sure nginx exists root@dlp:~# docker run srv.world/debian-nginx /usr/bin/which nginx /usr/sbin/nginx |
Sponsored Link |
|