Skip to content

Latest commit

 

History

History
executable file
·
65 lines (42 loc) · 1.9 KB

TASK_139_Create_a_Docker_image_from_container.md

File metadata and controls

executable file
·
65 lines (42 loc) · 1.9 KB

Start:         2023-06-28 22:42:00
Finished:   2023-06-28 22:46:12



TASK 139: Create a Docker Image From Container

Requirements

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 cluster:datacenter on Application Server 3 from a container ubuntu_latest that is running on same server.


Steps

Login to the app server and switch to root. For the server credentials, check out the Project Nautilus documentation.

sshpass -p  '**********' ssh -o StrictHostKeyChecking=no banner@172.16.238.12
sudo su -
********** 

Check the running container/s and the current image/s.

[root@stapp03 ~]# docker ps -a
CONTAINER ID   IMAGE     COMMAND       CREATED              STATUS          PORTS     NAMES
76a3fc780671   ubuntu    "/bin/bash"   About a minute ago   Up 59 seconds             ubuntu_latest

[root@stapp03 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
ubuntu       latest    99284ca6cea0   3 weeks ago   77.8MB

Create the image from the container.

docker commit ubuntu_latest cluster:datacenter  

Verify.

[root@stapp03 ~]# docker images
REPOSITORY   TAG          IMAGE ID       CREATED         SIZE
cluster      datacenter   d6b5bdb59d86   3 seconds ago   119MB
ubuntu       latest       99284ca6cea0   3 weeks ago     77.8MB 

Resources