Ubuntu 26.04

Docker : Add Container images2026/05/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

IMAGE           ID             DISK USAGE   CONTENT SIZE   EXTRA
ubuntu:latest   f3d28607ddd7        160MB         45.3MB    U

# 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
31b59da29156   ubuntu    "/bin/bash -c 'apt-g…"   9 seconds ago   Exited (0) 2 seconds ago             quirky_beaver

# add the image

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

sha256:305dfeaadebc3c077360047c4cc1673af0eaf2443b3955815e76e82c7fb647e0

root@dlp:~#
docker images
IMAGE                           ID             DISK USAGE   CONTENT SIZE   EXTRA
srv.world/ubuntu-nginx:latest   305dfeaadebc        227MB         69.9MB
ubuntu:latest                   f3d28607ddd7        160MB         45.3MB    U

# 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