Docker : Add Images2017/12/21 |
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 422dc563ca32 5 weeks ago 252 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 ... a4de985f662a fedora "/bin/bash -c 'dnf..." About a minute ago Exited (0) 14 seconds ago ... # add the image [root@dlp ~]# docker commit a4de985f662a srv.world/fedora_httpd sha256:32918df26202e1c22ac9b496cc51c2c451ad3511b160ddb8994010da63a8d834 # show images [root@dlp ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/fedora_httpd latest 32918df26202 12 seconds ago 564 MB docker.io/fedora latest 422dc563ca32 5 weeks ago 252 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 |