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
Dockerfile specified with -f not found within build context when cwd is a symlink #16339
Comments
I'm having this issue but without symlinks being used. |
I can confirm there is an identical failure without symlinks when using docker-machine on OSX. Using any folder outside the folders mounted in the VM will give this error (only when '-f Dockerfile' is used, it works outside the build context when no Dockerfile is specified. Possibly the same cause. OSX via dockermachine:
This (original) error occurs on Linux only with symlinks involved. I cannot reproduce on Linux without symlinks. |
Seeings same problem on CentOS 7 (Docker version 1.8.2, build 0a8c2e3). Worked around it using "
|
I want to take a shot at this one. |
@thaJeztah I misunderstood the issue yesterday. Today I just can't reproduce this using 'master' and 'bf80ade'. It seems this issue has been fixed. Here is the steps: (almost same as @jmanning2k did)
@jmanning2k It seems this issue has been fixed. Can you still reproduce this using current 'master' ? |
I have this issue as well, running Docker 1.8.3. The symptom is when trying to build an image using One temporary solution is: - cd ${TMPDIR:-/tmp}
+ cd -P ${TMPDIR:-/tmp}
docker build --file=Dockerfile |
Finally had a chance to test with 1.9.0 on linux and OSX, both working, no longer showing this error. |
Thanks @jmanning2k! Good to hear it's resolved |
Thanks ! |
I faced the same issue. I am using docker version:17.09.0-ce. I follow below steps. |
Description of problem:
Symlinks appear to be resolved for the build context path (#15039), however they are not normalized/resolved when checking if a Dockerfile specified with '-f' is within the build context.
docker version
:docker info
:uname -a
:Linux lims-jmanning 3.13.0-57-generic #95~precise1-Ubuntu SMP Mon Jun 22 09:43:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Environment details (AWS, VirtualBox, physical, etc.):
Both on Ubuntu based AWS node and a docker-machine image on OSX
How reproducible:
Always, given recipe below.
Steps to Reproduce:
Actual Results:
Build fails unless I provide fully resolved path to Dockerfile regardless of if cwd is symlinked path or '.'
Error given is a variant of:
unable to prepare context: The Dockerfile (/home/test/tmp/test-docker/Dockerfile) must be within the build context (.)
Expected Results:$(pwd)/Dockerfile $ (pwd) ## FAILS
These commands should work regardless of symlinks. As noted in
docker build -h
it should be valid to specifydocker build -f PATH/Dockerfile PATH
$ docker build -f Dockerfile . ## FAILS
$ docker build -f
Additional info:
Our build uses symlinks for build folder in some environmentsso that dev builds and production builds can use the same filesystem paths throughout.
Related to #15037, probably caused by #15039 / bdc55be (build context dir is normalized for symlinks, but not a Dockerfile specified with '-f').
I think #14339 is the same issue, but mistakenly closed as duplicate of a similar but non-identical issue.
In the real world case, I am attempting to use '-f Dockerfile_base', which is why I can't simply omit the '-f' flag.
Same behavior seen on:
Docker version 1.8.1, build d12ea79 (ubuntu)
Docker version 1.8.2, build 0a8c2e3 (OSX)
EDIT: Updated to bug report template.
The text was updated successfully, but these errors were encountered: