i would like to commit a container to create an image from this container, using python SDK
And
container = client.containers.run(name, [“touch”, “/name”], detach=True)
what is the meaning of the touch command ?
Share and learn in the Docker community.
i would like to commit a container to create an image from this container, using python SDK
And
container = client.containers.run(name, [“touch”, “/name”], detach=True)
what is the meaning of the touch command ?
container = client.containers.run(name, [“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
https://docker-py.readthedocs.io/en/stable/containers.html#docker.models.containers.Container.commit
commit(repository=None)
Repositiry can be the file /name created with the touch command
commit(“name”)
repository is the image name
We specify juste the name of the commit image or should we create smoething else in the commit(…) command
you can also add tag to repository(image)
Can we use commit command to create a copy of the container by launching an a new container from the commit image?
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