Docker : Add Container images2021/05/13 |
Add Container images you created.
|
|
[1] | For exmaple, 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 ubuntu latest 7e0aa2d69a15 2 weeks ago 72.7MB # start a Container and install nginx root@dlp:~# docker run ubuntu /bin/bash -c "apt-get update; apt-get -y install nginx" docker ps -a | head -2 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 555bbffdd1aa ubuntu "/bin/bash -c 'apt-g…" 36 seconds ago Exited (0) 14 seconds ago wonderful_nightingale # add the image root@dlp:~# docker commit 555bbffdd1aa srv.world/ubuntu-nginx sha256:8f1fbe417eb2f1260495629f350c75324368d9bce9c61262158813987f085273root@dlp:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/ubuntu-nginx latest 8f1fbe417eb2 16 seconds ago 160MB ubuntu latest 7e0aa2d69a15 2 weeks ago 72.7MB # generate a container from the new image and execute [which] to make sure nginx exists root@dlp:~# docker run srv.world/ubuntu-nginx /usr/bin/which nginx /usr/sbin/nginx |
Sponsored Link |