Docker : Add Container Images2019/05/10 |
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 d09302f77cfc 8 weeks ago 275 MB # start a Container and install httpd [root@dlp ~]# docker run fedora /bin/bash -c "dnf -y upgrade; dnf -y install httpd" docker ps -a | head -2 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 434f8f99fc2c fedora "/bin/bash -c 'dnf..." 2 minutes ago Exited (0) 44 seconds ago vigilant_volhard # add the image [root@dlp ~]# docker commit 434f8f99fc2c srv.world/fedora_httpd sha256:3e633f065d3bea9b6752ab6ebe9aa16d0a3a2d4bb824d44a06788cab9f794ea3 # show images [root@dlp ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/fedora_httpd latest 3e633f065d3b 22 seconds ago 595 MB docker.io/fedora latest d09302f77cfc 8 weeks ago 275 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 |
Sponsored Link |
|