Skip to content
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

To doc: Allow Dockerfile to be outside of build-context #6199

Closed
gbarr01 opened this issue Mar 12, 2018 · 5 comments
Closed

To doc: Allow Dockerfile to be outside of build-context #6199

gbarr01 opened this issue Mar 12, 2018 · 5 comments
Labels
area/engine Issue affects Docker engine/daemon lifecycle/locked
Milestone

Comments

@gbarr01
Copy link
Contributor

gbarr01 commented Mar 12, 2018

@gbarr01 gbarr01 added the area/engine Issue affects Docker engine/daemon label Mar 12, 2018
@gbarr01 gbarr01 added this to the engine/18.03 milestone Mar 12, 2018
@thaJeztah
Copy link
Member

Thanks! Yes, this would be mainly digging if we mention that the Dockerfile must be inside the build-context; which now is no longer a requirement, as now you can do:

docker build -f /some/path/anywhere/Dockerfile /some/other/path/to/build-context

@gbarr01
Copy link
Contributor Author

gbarr01 commented Mar 21, 2018

@thaJeztah ... I'm finding text from last October that already says this:

The current working directory where you are located when you issue a docker build command is called the build context, and the Dockerfile must be somewhere within this build context. By default, it is assumed to be in the current directory, but you can specify a different location by using the -f flag. Regardless of where the Dockerfile actually lives, all of the recursive contents of files and directories in the current directory are sent to the Docker daemon as the build context.

The first sentence is contradictory but from "By default" on, it appears that this feature may have been documented. What am I missing here? What is new?

@thaJeztah
Copy link
Member

I think the part that needs to be removed in that paragraph is "and the Dockerfile must be somewhere within this build context", otherwise that paragraph looks ok.

It was already possible to set the location of the Dockerfile using the -f flag, but previously that would fail if -f was not within the build-context, i.e., previously

This was allowed:

docker build -f /projects/my-project-files/subdir/Dockerfile /projects/my-project-files/

But this would fail (because /projects/dockerfiles/ is not inside /projects/my-project-files/) :

docker build -f /projects/dockerfiles/Dockerfile /projects/my-project-files/

@gbarr01
Copy link
Contributor Author

gbarr01 commented Mar 21, 2018

Got it. Thanks, @thaJeztah .

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

@docker docker locked and limited conversation to collaborators Mar 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/engine Issue affects Docker engine/daemon lifecycle/locked
Projects
None yet
Development

No branches or pull requests

3 participants