Ubuntu 22.04
Sponsored Link

Docker : Add Container images2022/09/08

 
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    2dc39ba059dc   5 days 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"

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

CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                     PORTS     NAMES
1ea2a7f09acc   ubuntu    "/bin/bash -c 'apt-g…"   24 seconds ago   Exited (0) 6 seconds ago             focused_proskuriakova

# add the image

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

sha256:51f5190bb9d9115447b0ec538cae5caaea859bcfa6c5537113c6a7758762f1f5

root@dlp:~#
docker images
REPOSITORY               TAG       IMAGE ID       CREATED          SIZE
srv.world/ubuntu-nginx   latest    51f5190bb9d9   18 seconds ago   170MB
ubuntu                   latest    2dc39ba059dc   5 days 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
Matched Content