39/100 Create a Docker Image From Container
One of the Nautilus developer was working to test new changes on a container. He wants to keep a backup of his changes to the container. A new request has been raised for the DevOps team to create a new image from this container. Below are more details about it:
a. Create an image news:nautilus
on Application Server 1
from a container ubuntu_latest
that is running on same server.
ssh tony@stapp01
# Checking to see which docker images exist
[tony@stapp01 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest ce8f79aecc43 4 days ago 78.1MB
# Checking to see what docker containers are running
[tony@stapp01 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f9b3bd7f78e0 ubuntu "/bin/bash" 3 minutes ago Up 3 minutes ubuntu_latest
# Create the image
[tony@stapp01 ~]$ docker commit ubuntu_latest news:nautilus
sha256:e9db9d0fe5f3230ae2b58748cf35ee4e6c14491ded2f57014eb5284df2698d32
# Confirm the new image
[tony@stapp01 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
news nautilus e9db9d0fe5f3 34 seconds ago 133MB
ubuntu latest ce8f79aecc43 4 days ago 78.1MB