Compose: permission denied

Created on 1 May 2018  路  5Comments  路  Source: docker/compose

Description of the issue

Just upgraded to docker CE (windows) Version 18.03.1-ce-win65 (17513)
Compose version 1.21.1

When running docker compose within my git repo I see a permissions error on particular file. (See stack trace below)

Context information (for bug reports)

Output of "docker-compose version"

docker-compose version 1.21.1, build 7641a569
docker-py version: 3.2.1
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017

Output of "docker version"

Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:12:48 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.24)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:21:42 2018
OS/Arch: windows/amd64
Experimental: false

Output of "docker-compose config"

Steps to reproduce the issue

  1. docker-compose in repo with visual studio solution containing database projects with .dbmdl files

Observed result

permission error as per message

Expected result

Success

Stacktrace / full error message

Building db
[10784] Failed to execute script docker-compose
Traceback (most recent call last):
  File "site-packages\docker\utils\build.py", line 179, in create_archive
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\darrell.tunnell\\Source\\Repos\\foo\\foo\\foo\\foo.DB.dbmdl'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 71, in main
  File "compose\cli\main.py", line 127, in perform_command
  File "compose\cli\main.py", line 282, in build
  File "compose\project.py", line 373, in build
  File "compose\service.py", line 1027, in build
  File "site-packages\docker\api\build.py", line 154, in build
  File "site-packages\docker\utils\build.py", line 31, in tar
  File "site-packages\docker\utils\build.py", line 183, in create_archive
OSError: Can not read file in context: C:\Users\darrell.tunnell\Source\Repos\foo\foo\foo.DB\foo.DB.dbmdl

Additional information

Windows 10
Installed docker CE for windows from stable channel latest installer.

Most helpful comment

Make sure your user has the necessary read access or add the file to your .dockerignore.

All 5 comments

Make sure your user has the necessary read access or add the file to your .dockerignore.

I have confirmed that my user does have full access rights to that file. I have deleted the file, rebuilt it but the docker issue persists. It's possible that another process is also accessing the file so perhaps that is surfacing as a "Permissions" issue error? Have added to the dockerignore file now as suggested, thanks.

@dazinator I have the same issue with a visual studio solution with a sqlproj. I have even added *.dbmdl to my .dockerignore I checked permissions. I am the owner and have full control of the file

I tried launching What finally worked was closing the solution in Visual Studio, so Visual Studio obviously has a lock on the file. I added a visual studio docker project to an existing visual studio solution, that happens to have a sql server project, and its almost boilerplate code. I just explicitly declared TCP ports. I'm really confused here, because I'm not seeing where that file is being part of a VOLUME or COPY

@shin- This is Visual Studio related, but, Visual Studio has docker support, and partners with docker. Can this be escalated internally?

@zippy1981 docker sends all files in its "build context" to the dameon, irrespective of which ones you then have ADD or COPY statements for. This is why in large repo's with lots of files, it will generally take a long time to do a docker build, even if you don't actually ADD or COPY any of them to the image :-)
Its pretty important to leverage the docker-ignore file in that case so you are excluding sending any unnecessary files to the daemon.

It took me a while to grok this - it is documented however: https://docs.docker.com/engine/reference/builder/#usage

Make sure your user has the necessary read access or add the file to your .dockerignore.

For me, just adding /vendor inside the .dockerignore file worked

Was this page helpful?
0 / 5 - 0 ratings