Ubuntu 24.04
Sponsored Link

Docker : Add Container images2024/06/13

 

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
ubuntu       latest    17c0145030df   13 days ago   76.2MB

# start a Container and install nginx

root@dlp:~#
docker run ubuntu /bin/bash -c "apt-get update; apt-get -y install nginx"

root@dlp:~#
docker ps -a | head -2

CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                       PORTS     NAMES
c2697d375f13   ubuntu    "/bin/bash -c 'apt-g…"   41 seconds ago   Exited (0) 25 seconds ago              focused_tesla

# add the image

root@dlp:~#
docker commit c2697d375f13 srv.world/ubuntu-nginx

sha256:f3f6605bb20c6717c5afe4b8ae29c608a8b99bdde5fce72de131cca1656ae816

root@dlp:~#
docker images
REPOSITORY               TAG       IMAGE ID       CREATED          SIZE
srv.world/ubuntu-nginx   latest    f3f6605bb20c   20 seconds ago   123MB
ubuntu                   latest    17c0145030df   13 days ago      76.2MB

# 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
Matched Content