CentOS 8
Sponsored Link

Docker : Add Container images2020/12/14

 
Add Container images you created.
[1] For exmaple, 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 days 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
896701f59aba   centos    "/bin/bash -c 'dnf -…"   49 seconds ago   Exited (0) 32 seconds ago              jovial_fermat

# add the image

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

sha256:a51947547c7140b4d522a4b2614316e0093896f8fb12678e99a80e0d8cdfccef

[root@dlp ~]#
docker images
REPOSITORY               TAG       IMAGE ID       CREATED          SIZE
srv.world/centos-nginx   latest    a51947547c71   12 seconds ago   285MB
centos                   latest    300e315adb2f   3 days 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