Forrest logo
back to the docker tool

docker:tldr:e9fe3

docker: Apply a `CMD` Dockerfile instruction to the created image.
$ docker commit --change="CMD ${command}" ${container} ${image}:${tag}
try on your machine

This command is used in Docker to create a new image from an existing container, with some changes applied. Here's what each part of the command means:

  • docker commit: This command is used to create a new image from a container.
  • --change="CMD ${command}": This flag specifies a change that should be applied to the new image. In this case, it sets the CMD instruction of the new image to the value of ${command}. The CMD instruction specifies the default command to run when a container is started from the image.
  • ${container}: This is the ID or name of the container from which the new image will be created.
  • ${image}:${tag}: This is the name and tag to be assigned to the newly created image.

In summary, this command creates a new image by making changes to an existing container. It sets the default command to ${command} in the new image.

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