Fedora 24
Sponsored Link

Docker : Add images
2016/06/30
 
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 current images

[root@dlp ~]#
docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/fedora    latest              f9873d530588        9 days ago          204.4 MB

# start a Container and install httpd

[root@dlp ~]#
docker run fedora /bin/bash -c "dnf -y update; dnf -y install httpd"

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

CONTAINER ID  IMAGE   COMMAND                  CREATED              STATUS                       PORTS  NAMES
8d1ddac43a77  fedora  "/bin/bash -c 'dnf -y"   About a minute ago   Exited (0) 22 seconds ago           furious_easley

# add the image

[root@dlp ~]#
docker commit 8d1ddac43a77 images/fedora_httpd

sha256:33906951c2a61c36e2fe1274a2c239f4030c506bf6fb4e4ac21bb073baf72634
# show current images

[root@dlp ~]#
docker images

REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
images/fedora_httpd   latest              33906951c2a6        20 seconds ago      544.9 MB
docker.io/fedora      latest              f9873d530588        9 days ago          204.4 MB

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

[root@dlp ~]#
docker run images/fedora_httpd /usr/sbin/httpd -V

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, 
Server version: Apache/2.4.18 (Fedora)
Server built:   Feb  4 2016 03:01:23
Server's Module Magic Number: 20120211:52
Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
.....
.....
Matched Content
 
Tweet