2021-10-13 12:57:11 -03:00
|
|
|
# docker commit
|
|
|
|
|
|
|
|
> Create a new image from a container’s changes.
|
2024-09-11 22:30:48 -07:00
|
|
|
> More information: <https://docs.docker.com/reference/cli/docker/container/commit/>.
|
2021-10-13 12:57:11 -03:00
|
|
|
|
|
|
|
- Create an image from a specific container:
|
|
|
|
|
|
|
|
`docker commit {{container}} {{image}}:{{tag}}`
|
|
|
|
|
|
|
|
- Apply a `CMD` Dockerfile instruction to the created image:
|
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`docker commit {{[-c|--change]}} "CMD {{command}}" {{container}} {{image}}:{{tag}}`
|
2021-10-13 12:57:11 -03:00
|
|
|
|
|
|
|
- Apply an `ENV` Dockerfile instruction to the created image:
|
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`docker commit {{[-c|--change]}} "ENV {{name}}={{value}}" {{container}} {{image}}:{{tag}}`
|
2021-10-13 12:57:11 -03:00
|
|
|
|
|
|
|
- Create an image with a specific author in the metadata:
|
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`docker commit {{[-a|--author]}} "{{author}}" {{container}} {{image}}:{{tag}}`
|
2021-10-13 12:57:11 -03:00
|
|
|
|
|
|
|
- Create an image with a specific comment in the metadata:
|
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`docker commit {{[-m|--message]}} "{{comment}}" {{container}} {{image}}:{{tag}}`
|
2021-10-13 12:57:11 -03:00
|
|
|
|
|
|
|
- Create an image without pausing the container during commit:
|
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`docker commit {{[-p|--pause]}} {{false}} {{container}} {{image}}:{{tag}}`
|
2021-10-13 12:57:11 -03:00
|
|
|
|
|
|
|
- Display help:
|
|
|
|
|
|
|
|
`docker commit --help`
|