CentOS Stream 8
Sponsored Link

Docker : Add Container images2021/04/06

 
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
centos       latest    300e315adb2f   3 months ago   209MB

# start a Container and install nginx

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

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

CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                       PORTS     NAMES
12f6995862c0   centos    "/bin/bash -c 'dnf -…"   29 seconds ago   Exited (0) 15 seconds ago              elastic_jemison

# add the image

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

sha256:ae7ab6688f5ee518e5a7f86d980fe219a88fce9309815b2f6e153556402b88cf

[root@dlp ~]#
docker images
REPOSITORY               TAG       IMAGE ID       CREATED         SIZE
srv.world/centos-nginx   latest    ae7ab6688f5e   7 seconds ago   289MB
centos                   latest    300e315adb2f   3 months ago    209MB

# 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