Docker : Add Container images
2020/06/02 |
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 1d622ef86b13 5 weeks ago 73.9MB # 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 42fd81ee0cee ubuntu "/bin/bash -c 'apt u…" 55 seconds ago Exited (0) 34 seconds ago interesting_wozniak # add the image root@dlp:~# docker commit 42fd81ee0cee srv.world/ubuntu_nginx d30733d4f31594f46deda79629adc9b92852f1f48062a2401549903095f2cdecroot@dlp:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/ubuntu_nginx latest d30733d4f315 9 seconds ago 155MB ubuntu latest 1d622ef86b13 5 weeks ago 73.9MB # 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 |