-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Modify a 'docker build' command with no context specified to infer "." as the context. #2947
base: master
Are you sure you want to change the base?
Modify a 'docker build' command with no context specified to infer "." as the context. #2947
Conversation
…context of '.'. Also update documentation to match. Signed-off-by: Marshall Conover <[email protected]>
89659b8
to
37402b4
Compare
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.
Thanks for contributing! This change will need further discussion. We've had a look at similar changes in the past, and there's some reasons for not making this change;
- keeping it explicit makes sure that unintended missing paths produce an error, instead of "silently" picking the current directory. These situations happen, e.g., when using an environment variable to specify the path (
docker build $SOME_VARIABLE
) - we want to keep the option open to use
docker build
(without specifying options or a path) to perform a more "interactive" build. No decisions were made on this yet, but changing the behavior to default to.
would no longer allow us to move in that direction without introducing a breaking change.
For reasons above, I'm "-1" on merging this; I do understand where you're coming from though 🤗
Hi thaJeztah! I don't know if that's considered the final word or not, but in case not, I'll just throw in a few thoughts:
Let me know if it would be more convenient to discuss this in another spot, and thanks for your time! |
Signed-off-by: Marshall Conover <[email protected]>
Signed-off-by: Marshall Conover <[email protected]>
acd9820
to
eafac7c
Compare
I've added informational output to inform the user when the context has been inferred, e.g.:
|
Signed-off-by: Marshall Conover <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #2947 +/- ##
==========================================
- Coverage 57.10% 57.06% -0.04%
==========================================
Files 299 299
Lines 18665 18674 +9
==========================================
- Hits 10658 10657 -1
- Misses 7146 7155 +9
- Partials 861 862 +1 |
Also update documentation to match.
Signed-off-by: Marshall Conover [email protected]
- What I did
Removed the requirement to specify a context when running docker build.
- How I did it
Modified the options parsing for
docker build
to use the current working directory as the context when no context is specified.- How to verify it
In a directory with a Dockerfile, and with an updated binary, run:
You will see a line to stdout with the message
followed by the docker build command executing as if you had run
docker build .
.This is in contrast to the previous behavior, in which case running
docker build
would return:followed by the client exiting.
- Description for the changelog
Infer the local directory as the context to use if no context is specified.
docker build
is now the same asdocker build .
- A picture of a cute animal (not mandatory but encouraged)

Important Notes
Thanks!
(PR for #2946 )