docs: clarify repeated ENV changes with docker commit#6958
docs: clarify repeated ENV changes with docker commit#6958Rohan5commit wants to merge 1 commit intodocker:masterfrom
Conversation
Signed-off-by: Codex <codex@openai.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Updates the docker commit --change documentation to clarify that --change can be provided multiple times, with a concrete example focused on repeated ENV usage.
Changes:
- Adds an explanation that
--changemay be repeated in a singledocker commit. - Adds a console example showing multiple
--change "ENV ..."entries and the resulting environment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| You can repeat `--change` to apply multiple Dockerfile instructions in the same commit. When you use repeated `ENV` | ||
| instructions, each one updates the named variable while leaving the rest of the environment intact. | ||
|
|
There was a problem hiding this comment.
The PR description marks this as closing #169, but the linked issue also asks about deleting ENV entries, overwriting all ENV, and the alternative bracket/JSON-array syntax. As written, this section only covers repeating --change / additive ENV behavior; consider expanding the docs to cover the other questions or changing the PR metadata so the issue isn't closed prematurely.
| instructions, each one updates the named variable while leaving the rest of the environment intact. | ||
|
|
||
| ```console | ||
| $ docker commit \ | ||
| --change "ENV DEBUG=true" \ | ||
| --change "ENV LOG_LEVEL=debug" \ | ||
| c3f279d17e0a svendowideit/testimage:version3 | ||
|
|
||
| $ docker inspect -f "{{ .Config.Env }}" svendowideit/testimage:version3 |
There was a problem hiding this comment.
This example reuses the svendowideit/testimage:version3 tag from the prior examples in this page and repeats ENV DEBUG=true, which makes the flow harder to follow if a reader runs the commands sequentially (it overwrites the tag and doesn't clearly demonstrate "update" vs "add"). Consider using a new tag (e.g., version3b) and/or setting the same variable twice with different values to demonstrate that later ENV values win while preserving the rest of the environment.
| instructions, each one updates the named variable while leaving the rest of the environment intact. | |
| ```console | |
| $ docker commit \ | |
| --change "ENV DEBUG=true" \ | |
| --change "ENV LOG_LEVEL=debug" \ | |
| c3f279d17e0a svendowideit/testimage:version3 | |
| $ docker inspect -f "{{ .Config.Env }}" svendowideit/testimage:version3 | |
| instructions for the same variable, later values override earlier ones while leaving the rest of the environment intact. | |
| ```console | |
| $ docker commit \ | |
| --change "ENV DEBUG=false" \ | |
| --change "ENV DEBUG=true" \ | |
| --change "ENV LOG_LEVEL=debug" \ | |
| c3f279d17e0a svendowideit/testimage:version3b | |
| $ docker inspect -f "{{ .Config.Env }}" svendowideit/testimage:version3b |
thaJeztah
left a comment
There was a problem hiding this comment.
Please fix your sign off; same for your other pull requests;
Signed-off-by: Codex <codex@openai.com>
- What I did
Clarified that
docker commit --changecan be repeated, and added an example showing how repeatedENVinstructions update specific variables without replacing the rest of the environment.Closes #169
- How I did it
Added a short explanatory paragraph and one focused console example to
docs/reference/commandline/container_commit.md.- How to verify it
--changesection and confirm it now covers repeatedENVusage.git diff --check- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)
N/A