Docker : Add Container Images2018/11/07 |
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 c582c1438f27 8 weeks ago 254 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 60c278b2ee8f fedora "/bin/bash -c 'dnf..." 2 minutes ago Exited (0) 10 seconds ago jovial_bhabha # add the image [root@dlp ~]# docker commit 60c278b2ee8f srv.world/fedora_httpd sha256:797e290c206f1910bfed4ac16a740d77b7790ef4f96de18cd37a816ebdbc6ae6 # show images [root@dlp ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/fedora_httpd latest 797e290c206f 11 seconds ago 526 MB docker.io/fedora latest c582c1438f27 8 weeks ago 254 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 |
|