Skip to content

docs: clarify repeated ENV changes with docker commit#6958

Open
Rohan5commit wants to merge 1 commit intodocker:masterfrom
Rohan5commit:docs/commit-change-env-clarification-20260426
Open

docs: clarify repeated ENV changes with docker commit#6958
Rohan5commit wants to merge 1 commit intodocker:masterfrom
Rohan5commit:docs/commit-change-env-clarification-20260426

Conversation

@Rohan5commit
Copy link
Copy Markdown

- What I did

Clarified that docker commit --change can be repeated, and added an example showing how repeated ENV instructions 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

  • Read the updated --change section and confirm it now covers repeated ENV usage.
  • git diff --check

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

N/A

Signed-off-by: Codex <codex@openai.com>
Copilot AI review requested due to automatic review settings April 26, 2026 03:16
@Rohan5commit Rohan5commit requested review from a team and thaJeztah as code owners April 26, 2026 03:16
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --change may be repeated in a single docker 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.

Comment on lines +82 to +84
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.

Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +91
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
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix your sign off; same for your other pull requests;

Signed-off-by: Codex <codex@openai.com>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: improve documentation for docker commit --change

5 participants