-
Notifications
You must be signed in to change notification settings - Fork 2.1k
docs: clarify repeated ENV changes with docker commit #6958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -79,6 +79,20 @@ $ docker inspect -f "{{ .Config.Env }}" f5283438590d | |||||||||||||||||||||||||||||||||||||||
| [HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true] | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```console | ||||||||||||||||||||||||||||||||||||||||
| $ docker commit \ | ||||||||||||||||||||||||||||||||||||||||
| --change "ENV DEBUG=true" \ | ||||||||||||||||||||||||||||||||||||||||
| --change "ENV LOG_LEVEL=debug" \ | ||||||||||||||||||||||||||||||||||||||||
| c3f279d17e0a svendowideit/testimage:version3 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| $ docker inspect -f "{{ .Config.Env }}" svendowideit/testimage:version3 | ||||||||||||||||||||||||||||||||||||||||
|
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 | |
| 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 |
There was a problem hiding this comment.
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/ additiveENVbehavior; consider expanding the docs to cover the other questions or changing the PR metadata so the issue isn't closed prematurely.