CentOS Stream 9
Sponsored Link

Docker : Add Container images2022/07/29

 
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
quay.io/centos/centos   stream9   61674c24ebbf   30 hours ago   152MB

# start a Container and install nginx

[root@dlp ~]#
docker run quay.io/centos/centos:stream9 /bin/bash -c "dnf -y install nginx"

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

CONTAINER ID   IMAGE                           COMMAND                  CREATED          STATUS                        PORTS     NAMES
22a6117082b3   quay.io/centos/centos:stream9   "/bin/bash -c 'dnf -…"   52 seconds ago   Exited (0) 15 seconds ago               blissful_shtern

# add the image

[root@dlp ~]#
docker commit 22a6117082b3 srv.world/centos-nginx

sha256:7fd90c511873e7f7ab555dcea0b41d6a1165a86806d62c3063fc0cca4a877889

[root@dlp ~]#
docker images
REPOSITORY               TAG       IMAGE ID       CREATED          SIZE
srv.world/centos-nginx   latest    7fd90c511873   15 seconds ago   251MB
quay.io/centos/centos    stream9   61674c24ebbf   30 hours ago     152MB

# Generate a Container from the new image and execute [which] to make sure nginx exists

[root@dlp ~]#
docker run srv.world/centos-nginx /usr/bin/whereis nginx

nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz
Matched Content