Fedora 28
Sponsored Link

Docker : Add Images2018/05/30

 
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
docker.io/fedora    latest              cc510acfcd70        3 weeks ago         253 MB

# start a Container and install httpd

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

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

CONTAINER ID    IMAGE     COMMAND                  CREATED              STATUS                    ...
2aea016e5d98    fedora    "/bin/bash -c 'dnf..."   About a minute ago   Exited (0) 14 seconds ago ...

# add the image

[root@dlp ~]#
docker commit 2aea016e5d98 srv.world/fedora_httpd

sha256:f153182d83f9b3d82042bfe41cc65d13b80ac48cde27b24306cc484f9cdf0d02
# show images

[root@dlp ~]#
docker images

REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
srv.world/fedora_httpd   latest              f153182d83f9        15 seconds ago      525 MB
docker.io/fedora         latest              cc510acfcd70        3 weeks ago         253 MB

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

[root@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