Docker : Add Container images2023/04/27 |
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 08d22c0ceb15 7 weeks ago 77.8MB # 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 c1ca80717d10 ubuntu "/bin/bash -c 'apt-g…" About a minute ago Exited (0) About a minute ago strange_carson # add the image root@dlp:~# docker commit c1ca80717d10 srv.world/ubuntu-nginx sha256:df0287c5017d207dc68035d2bde5500ac6aec1d27231dc98b2c06ea5d4fdb35croot@dlp:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/ubuntu-nginx latest df0287c5017d 10 seconds ago 177MB ubuntu latest 08d22c0ceb15 7 weeks ago 77.8MB # 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 |