SLES 15
Sponsored Link

Docker : Add Container Images
2019/01/22
 
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

dlp:~ #
docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
fedora              latest              26ffec5b4a8a        5 days ago          274MB

# start a Container and install httpd

dlp:~ #
docker run fedora /bin/bash -c "dnf -y upgrade; dnf -y install httpd"

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

CONTAINER ID    IMAGE     COMMAND                  CREATED              STATUS                       PORTS     NAMES
42a1d4167a7b    fedora    "/bin/bash -c 'dnf -…"   About a minute ago   Exited (0) 13 seconds ago              pedantic_almeida

# add the image

dlp:~ #
docker commit 42a1d4167a7b srv.world/fedora_httpd

sha256:5b6251fe21ea41ba79263c7eff0b74099a395b3ef3e7cbb87593cef073952c59

# show images

dlp:~ #
docker images

REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
srv.world/fedora_httpd   latest              5b6251fe21ea        12 seconds ago      499MB
fedora                   latest              26ffec5b4a8a        5 days ago          274MB

# generate a Container from the new image and execute [whereis] to make sure httpd exists

dlp:~ #
docker run srv.world/fedora_httpd /usr/bin/whereis httpd

httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/share/httpd
Matched Content