Add Images for container.
| |
[1] | For exmaple, update official image with installing httpd 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 VIRTUAL SIZE centos 7 8efe422e6104 4 days ago 224 MB centos centos7 8efe422e6104 4 days ago 224 MB centos latest 8efe422e6104 4 days 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 a0294a053f8c centos:7 "/bin/bash -c 'yum - 37 seconds ago Exited (0) 19 seconds ago suspicious_morse
# add the Image
[root@dlp ~]#
docker commit a0294a053f8c my_image/centos_httpd
d0938f54bfd62c2a108249c1f969aaeb80be51fbbaee15b594004d4875327609
# show images
[root@dlp ~]#
docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE my_image/centos_httpd latest d0938f54bfd6 17 seconds ago 338.3 MB centos 7 8efe422e6104 4 days ago 224 MB centos centos7 8efe422e6104 4 days ago 224 MB centos latest 8efe422e6104 4 days ago 224 MB
# Generate a Container from the new image and execute which command to make sure httpd exists
[root@dlp ~]#
docker run my_image/centos_httpd /usr/bin/which httpd
/usr/sbin/httpd |
No comments:
Post a Comment