Debian 9 Stretch
Sponsored Link

Docker : Add Images2017/08/03

 
Add Images for Containers.
[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             SIZE
debian              latest              a20fd0d59cf1        8 days ago          100MB

# start a Container and install apache2

root@dlp:~#
docker run debian /bin/bash -c "apt update; apt -y install apache2"

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

CONTAINER ID  IMAGE   COMMAND                 CREATED              STATUS          PORTS  NAMES
b70ebe3493ae  debian  "/bin/bash -c 'apt..."  About a minute ago   Exited (0) 40..        eloquent_..

# add the Image

root@dlp:~#
docker commit b70ebe3493ae srv.world/deb_apache2

sha256:8efc6944bf8dc725b6a2f5c73b6480b064b95f72fb0a3526ab51df43bc55286c

root@dlp:~#
docker images
REPOSITORY              TAG            IMAGE ID            CREATED             SIZE
srv.world/deb_apache2   latest         8efc6944bf8d        18 seconds ago      219MB
debian                  latest         a20fd0d59cf1        8 days ago          100MB

# Generate a Container from the new image and execute [which] to make sure apache2 exists

root@dlp:~#
docker run srv.world/deb_apache2 /usr/bin/which apache2

/usr/sbin/apache2
Matched Content