Docker : Add Images2014/03/13 |
Add Images for containers.
|
|
[1] | For exmaple, update official image with installing httpd and add it as a new image for containers. 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 VIRTUAL SIZE centos 7 8efe422e6104 2 weeks ago 224 MB centos centos7 8efe422e6104 2 weeks ago 224 MB centos latest 8efe422e6104 2 weeks ago 224 MB # start a Container and install httpd [root@dlp ~]# docker run centos /bin/bash -c "yum -y update; yum -y install httpd"
docker ps -a | head -2 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 323ceff31212 centos:7 "/bin/bash -c 'yum - 34 seconds ago Exited (0) 14 seconds ago silly_pike # add the Image [root@dlp ~]# docker commit 323ceff31212 custom/centos_httpd bb3a95ec2497a6f99fefa15334fc2ac709c31222023fc9e46eee145d4eb90d09 docker images # show images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE custom/centos_httpd latest bb3a95ec2497 28 seconds ago 338.7 MB centos 7 8efe422e6104 2 weeks ago 224 MB centos centos7 8efe422e6104 2 weeks ago 224 MB centos latest 8efe422e6104 2 weeks ago 224 MB # Generate a Container from the new image and execute which command to make sure httpd exists [root@dlp ~]# docker run custom/centos_httpd /usr/bin/which httpd /usr/sbin/httpd |
Sponsored Link |
|