Forrest logo
back to the docker tool

docker:tldr:ba1ef

docker: Apply an `ENV` Dockerfile instruction to the created image.
$ docker commit --change="ENV ${name}=${value}" ${container} ${image}:${tag}
try on your machine

The docker commit command in Docker is used to create a new image based on the changes made in a container.

In the given command, the following parameters are used:

  • --change: This parameter is used to specify a change to apply to the container before creating the new image. In this case, it is an environment variable change specified in the format "ENV ${name}=${value}", where ${name} is the name of the environment variable and ${value} is its value.

  • ${container}: This is the name or ID of the container that you want to create a new image from.

  • ${image}:${tag}: This specifies the name and tag of the new image that will be created.

By executing the docker commit command with these parameters, Docker will create a new image by taking the current state of the specified container and applying the specified change (environment variable) in that container. The resulting image will be tagged with the specified name and tag.

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