Docker Community Forums

Share and learn in the Docker community.

How can i commit a container using python sdk?


i would like to commit a container to create an image from this container, using python SDK

container =, [“touch”, “/name”], detach=True)
what is the meaning of the touch command ?

(Nitishmowall) #2

container =, [“touch”, “/name”], detach=True)

here you are running a bash command touch to create file /name.

for committing a container using python Sdk please read below link

1 Like

Repositiry can be the file /name created with the touch command

(Nitishmowall) #4

repository is the image name

1 Like

We specify juste the name of the commit image or should we create smoething else in the commit(…) command

(Nitishmowall) #6

you can also add tag to repository(image)

1 Like

Can we use commit command to create a copy of the container by launching an a new container from the commit image?

(Nitishmowall) #8

you can create multiple images using commit( it commit the changes made in the container to image). And then can start containers using those images.
SO yes

1 Like