Author Archives: SandeepSingh DBA

About SandeepSingh DBA

Hi, I am working in IT industry with having more than 10 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Create a new image from stopped container in Docker

Commit a new image with stopped container in Docker

Check the stopped container in Docker

#docker ps -a

sunny@Oracle1:/etc$ docker ps -a

CONTAINER ID   IMAGE         COMMAND     CREATED       STATUS                     PORTS     NAMES

eeb55035fffe   orcl2-image   "/bin/sh"   3 hours ago   Exited (0) 3 seconds ago             fervent_herschel

sunny@Oracle1:/etc$ 

Create an image from the stopped container:

#docker commit <imageid> <new image name>

or

#docker commit <imagename> <new image name>

sunny@Oracle1:/etc$ docker commit eeb55035fffe image-oracle

sha256:fead993590ebd2eacb4a367cc2a057ebb6c7b1ab5e920a790a0fb45ece1db95f

Verify the created image:

sunny@Oracle1:/etc$ docker images

REPOSITORY                                       TAG         IMAGE ID       CREATED          SIZE

image-oracle                                     latest      fead993590eb   27 seconds ago   15.8GB

orcl2-image                                      latest      e28a1ae656c2   3 hours ago      15.8GB

Run the image for testing purpose:

sunny@Oracle1:/etc$ docker run -it image-oracle 

sh-4.2$ 

sh-4.2$ 

sh-4.2$ ls

setPassword.sh

sh-4.2$