Ubuntu 16.04
Sponsored Link

Docker : Add Images2016/06/17

 
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             SIZE
ubuntu              latest              2fa927b5cdd3        2 weeks ago         122 MB

# start a Container and install httpd

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

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

CONTAINER ID   IMAGE   COMMAND                  CREATED              STATUS                     PORTS  NAMES
f0f72f922cd4   ubuntu  "/bin/bash -c 'apt-ge"   About a minute ago   Exited (0) 6 seconds ago          stoic_pike

# add the image

root@dlp:~#
docker commit f0f72f922cd4 my_image/ubuntu_httpd

b585ff101b08bedb73799f162f7c44c24491e4645f17ed89e4ed57ccb31be98d
root@dlp:~#
docker images
root@dlp:~# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED              SIZE
my_image/ubuntu_httpd   latest              65d1b6d04b37        About a minute ago   258.7 MB
ubuntu                  latest              2fa927b5cdd3        2 weeks ago          122 MB

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

root@dlp:~#
docker run my_image/ubuntu_httpd /usr/bin/which apache2

/usr/sbin/apache2
Matched Content