Docker : Add Container images2025/08/08 |
|
Add Container images you created. |
|
| [1] | For example, update official image with installing Nginx 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 quay.io/centos/centos stream10 02ae49ff109e 7 weeks ago 306MB # start a Container and install nginx [root@dlp ~]# docker run quay.io/centos/centos:stream10 /bin/bash -c "dnf -y install nginx" docker ps -a | head -2 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 02a2e6c27ce5 quay.io/centos/centos:stream10 "/bin/bash -c 'dnf -..." 20 seconds ago Exited (0) 12 seconds ago hungry_napier # add the image [root@dlp ~]# docker commit 02a2e6c27ce5 srv.world/centos-nginx sha256:b587aa926cbff4940a8d51999a9b21826cb86675cf419f79f3097af9d2c613b1[root@dlp ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE srv.world/centos-nginx latest b587aa926cbf 13 seconds ago 345MB quay.io/centos/centos stream10 02ae49ff109e 7 weeks ago 306MB # generate a container from the new image and make sure nginx exists [root@dlp ~]# docker run srv.world/centos-nginx nginx -v nginx version: nginx/1.26.3 |
| Sponsored Link |
|
|