Files
tldr/pages/common/docker-commit.md
2021-10-13 16:57:11 +01:00

33 lines
966 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# docker commit
> Create a new image from a containers changes.
> More information: <https://docs.docker.com/engine/reference/commandline/commit/>.
- Create an image from a specific container:
`docker commit {{container}} {{image}}:{{tag}}`
- Apply a `CMD` Dockerfile instruction to the created image:
`docker commit --change="CMD {{command}}" {{container}} {{image}}:{{tag}}`
- Apply an `ENV` Dockerfile instruction to the created image:
`docker commit --change="ENV {{name}}={{value}}" {{container}} {{image}}:{{tag}}`
- Create an image with a specific author in the metadata:
`docker commit --author="{{author}}" {{container}} {{image}}:{{tag}}`
- Create an image with a specific comment in the metadata:
`docker commit --message="{{comment}}" {{container}} {{image}}:{{tag}}`
- Create an image without pausing the container during commit:
`docker commit --pause={{false}} {{container}} {{image}}:{{tag}}`
- Display help:
`docker commit --help`