Forrest logo
back to the docker tool

docker:tldr:677cc

docker: Create a new image from a container's changes.
$ docker container commit ${container_name}
try on your machine

The docker container commit command is used to create a new image from a running container. Here's a breakdown of the command:

  • docker container commit: This is the command to create a new image from a container.
  • ${container_name}: This is a placeholder for the name or ID of the running container you want to commit.

When you run this command, Docker takes a snapshot of the running container's filesystem and creates a new image from it. This image can then be used to create new containers with the same filesystem state.

For example, if you have a container named "my-container" and you want to create a new image based on its current state, you would run:

docker container commit my-container

After the command completes successfully, Docker would create a new image. The image would typically be assigned a unique ID, which you can use to reference it in other commands.

You can later use this image to spin up new containers with the same filesystem state by using the docker run command.

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