Skip to content

Commit 218a842

Browse files
committed
docs: clarify repeated ENV changes with docker commit
Signed-off-by: Codex <codex@openai.com>
1 parent 0b459a4 commit 218a842

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/reference/commandline/container_commit.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ $ docker inspect -f "{{ .Config.Env }}" f5283438590d
7979
[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true]
8080
```
8181

82+
You can repeat `--change` to apply multiple Dockerfile instructions in the same commit. When you use repeated `ENV`
83+
instructions, each one updates the named variable while leaving the rest of the environment intact.
84+
85+
```console
86+
$ docker commit \
87+
--change "ENV DEBUG=true" \
88+
--change "ENV LOG_LEVEL=debug" \
89+
c3f279d17e0a svendowideit/testimage:version3
90+
91+
$ docker inspect -f "{{ .Config.Env }}" svendowideit/testimage:version3
92+
93+
[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true LOG_LEVEL=debug]
94+
```
95+
8296
### Commit a container with new `CMD` and `EXPOSE` instructions
8397

8498
```console

0 commit comments

Comments
 (0)