CentOS 7
Sponsored Link

Docker : Add Container images2015/01/10

 
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   5 months ago   209MB

# start a Container and install nginx

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

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

CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                          PORTS     NAMES
12e2766b510e   centos    "/bin/bash -c 'yum -…"   35 seconds ago   Exited (0) 3 seconds ago                  affectionate_shtern

# add the image

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

sha256:6adb1438d24f7f1f55438f9ff86d67b78f05ccee8bca7464247473aa588691be

[root@dlp ~]#
docker images
REPOSITORY               TAG       IMAGE ID       CREATED         SIZE
srv.world/centos-nginx   latest    6adb1438d24f   8 seconds ago   289MB
centos                   latest    300e315adb2f   5 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