-
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
Permission denied error on build when a non-accessible folder exists, regardless of the content in the .dockerignore #3043
Comments
Thanks for reporting; this looks like a duplicate of (or very similar to) docker/buildx#1781 (and docker/for-linux#380). Let me close this one in favor of the existing ticket |
This does not look like a duplicate of issue docker/buildx#1781. This is not about the Dockerfile location (along with non-accessible folders) it is about a non-accessible folder in the current folder which even though in the .dockerignore lead to a The workaround described in docker/buildx#1781 does not fix the issue here. Update: it looks like non-accessible files are ignored OK, folders are not. |
@thaJeztah I do not believe this to be an exact duplicate of docker/buildx#1781 since that issue mentions that it "only happens with DOCKER_BUIILDKIT=1". This issue occurs for me regardless of if I use Buildkit or not. It's just that Buildkit gives a more descriptive error message. Sorry if that was unclear in the original issue description. |
Is there a workaround or which older version can I use safely? |
Looks like this is still an issue in Docker version 27.1.1, build 6312585 on linux. I've got a directory under the build directory to which Docker does not have access. The directory is in the |
Same with version 27.3.1 (6.8.0-45-generic #45-Ubuntu x86_64 x86_64 x86_64 GNU/Linux) |
Locking the conversation on this ticket, because the BuildKit client code is no longer in the docker CLI itself, but now handled by buildx, and there's a tracking ticket for this issue in the buildx issue tracker; |
Steps to reproduce the issue:
Dockerfile
in your current directory, the exact content of it doesn't matter as long as it's valid.mkdir foo chmod 700 foo chown 999:999 foo # Make sure this is a uid/gid different from your own.
.dockerignore
with the following content:docker build .
(you can prefix it withDOCKER_BUILDKIT=1
for a more descriptive error message).Describe the results you received:
The build fails because the directory
foo
isn't accessible.Describe the results you expected:
Since the
.dockerignore
states that everything should be excluded I was surprised that the non-accessible folder was causing problems. I would expect docker to completely ignore that folder during a build.This causes some real world problems for me because the official Postgres Dockerfile sets up it's
.pgdata
directory with the uid/gid 999:999. Once that directory exists I'm unable to build any more docker images.I'm currently using a workaround where I manually change the owner of
.pgdata
to my own uid/gid (sudo chown -R $(id -u):$(id -g) .pgdata
), and then specify the user in mydocker-compose.yml
. This is not ideal, and it would be sweet ifdocker build
could stop trying to access directories / files excluded by the.dockerignore
.Output of
docker version
:Output of
docker info
:The text was updated successfully, but these errors were encountered: