Forrest logo
back to the docker tool

docker:tldr:a1753

docker: Create an image from a specific container.
$ docker commit ${container} ${image}:${tag}
try on your machine

The command "docker commit ${container} ${image}:${tag}" is used to create a new image from an existing Docker container.

Here's a breakdown of the command:

  • "docker commit" is the command to create a new image.
  • "${container}" is the placeholder for the ID or name of the container you want to create an image from. For example, it could be the container ID like "2e3f4b5f67a" or the container name like "my-container".
  • "${image}:${tag}" specifies the name and version (tag) for the new image. For example, you could use "my-image:latest" or "my-image:v1.0" as the image name and tag.

Putting it together, when you run the command with actual values, it creates a new image by taking a snapshot of the specified container at its current state. The new image will be tagged with the provided name and tag, making it ready to be used or shared with others.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool