VS2017 Failed to execute script docker-compose Permission denied: \\v15\\Server\\sqlite3\\db.lock'
- Windows Version: W10 1709
- Docker for Windows Version: 18.03.0-ce-win59 Stable
- Visual Studio 15.6.5
Expected behavior
Beeing able to build release of a core project using vs2017 docker support
Actual behavior
the docker compose launch a python script : "site-packages\docker\utils\utils.py" which is trying to read sqlite3\db.lock manage by vs2017 => OSError: Can not read file in context: ....sqlite3\db.lock
Steps to reproduce the behavior
if your context is at the same level as the .vs folder you encounter this problem
I've just started seeing this issue also.
Windows Version: W10 1709 Docker for Windows Version: 18.03.0-ce-win59 Stable Visual Studio 15.6.2
I was able to get it working again by downgrading Docker to 17.12.0.
I have opened a ticket on visual studio developer community https://developercommunity.visualstudio.com/content/problem/229557/vs2017-docker-linux-build-can-not-read-file-in-con.html
Try creating a .dockerignore file with the following contents:
.vs/
thanks @photomoose !!! As i have amended the context folder of docker compose from context: . to context: ../ this file was not in the good folder VS2017 already generate a .dockerignore that contains a .vs entry
i'm closing this ticket and will add solution in vs studio community ticket as well
In my case, docker compose context dir does not same as docker-compose.yml's folder too.
Here is my directory structure.
/ <---- This is docker compose context dir
.dockerignore
MyApp/
MyApp.csproj
Dockerfile
Program.cs
MyApp.solution/
.vs/
MyApp.dcproj
docker-compose.yml
docker-compose.override.yml
OtherApp/
SharedLib1/
SharedLib2/
/MyApp.solution/docker-compose.yml
version: '3.4'
services:
myapp:
image: ${DOCKER_REGISTRY}myapp
build:
context: ../ <---- Changed context dir to the root dir
dockerfile: MyApp/Dockerfile
The problem is failed to ignore /MyApp.solution/.vs folder. so I changed /.dockerignore file as follows.
.dockerignore
.env
.git
.gitignore
.vs
.vscode
docker-compose.yml
docker-compose.*.yml
*/bin
*/obj
*/.vs <---- Added this line
This issue reproduces for me even with .dockerignore. Docker 18.06.1-ce Win 10 1607 VS 2017 Pro 15.8.1
My folder structure is similar to following:
SolutionDir <-- this is the context
.git
.vs <-- .vs and .dockerignore are on the same level
docker
tests
docker-compose.yml <-- this file I'm trying to use
test.dockerfile
src
MyProj1
MyProj2
.dockerignore
MyApp.sln
The docker-compose.yml which I'm trying to use contains this:
build:
context: ./../../
dockerfile: ./docker/tests/tests.dockerfile
So I'm setting context to SolutionDir. This folder contains .vs folder and .dockerignore file which has the lines:
.vs
*/.vs
...and it has no effect, I still get "OSError: Can not read file in context:" for file from .vs folder.
Thoughts? Thanks in advance!
hi try using : ../../../ the path is related to your project folder and not to your root folder
But the dockerfile argument is based on context, right? so if context is set to wrong folder the path ./docker/tests/tests.dockerfile will not point to correct dockerfile. But it actually does, so my context is correct - the SolutionDir which has docker folder so I am able to get tests.dockerfile.
I actually tried to change context to ../../../ anyway and indeed it was pointing to parent dir of SolutionDir and started adding everything from higher level. And eventually failed because I have another solution from another folder opened in VS and it also has a locked file in .vs folder...
Also I made it so that container will remain running so I can connect and see what's in it. And looks like .dockerignore has no effect at all... All files and folders listed in it (.git, */bin, */obj etc) are there, copied as everything else. Strange...
when you launch build command in VS from docker-compose entry in the output window you will get the full path of the context currently used :
docker-compose -f "D:\Dev\BeeMusic\BeeMusic.Docker.ImageBackgroundSlave\docker-compose.yml" -f "D:\Dev\BeeMusic\BeeMusic.Docker.ImageBackgroundSlave\docker-compose.override.yml" -p dockercompose10200210715878578214 --no-ansi config 4>services: 4> beemusic.docker.imagebackgroundslave: 4> build: 4> context: D:\Dev\BeeMusic
the bold value is actually where i have put my .dockerignore file Check what ../../../ means in your case
I've checked docker-compose.yml with config command: context: ./../../ leads to SolutionDir which is correct and this is where .dockerignore is, context: ../../../ leads to its parent folder. I have tried also context: ../../ which also leads to SolutionDir but unfortunately doesn't solve the issue.
then i don't understand why ! just in case this is the content of my .dockerignore .dockerignore .env .git .gitignore .vs .vscode docker-compose.yml docker-compose.*.yml */bin */obj
Found what was wrong: my .dockerignore file was encoded incorrectly! I was too lazy to type everything and copied most of it from another place... and the encoding didn't match! Today I tried to build all images from compose file one by one with docker build command and it started giving me errors like <input>:1:7: illegal character NUL. When using docker-compose the errors are lost and .dockerignore file is ignored (oh, the irony). I changed encoding on the .dockerignore file and saved it and it worked!
Another statement worthy of being hanged on the wall: when working with mixed OS environments keep track of encoding and EOL xD
Thanks a lot for your help!
This happened to me without much clue as why. I resolved by changing the dockerfile and context locations to absolute locations rather than relative inside the docker-compose file. i.e. c:\git\project\dockerfile
Everything else appeared to be in place, it seemed to totally be ignoring my dockerignore file; I copied it from another docker project which was working when I checked last. Not sure, it all feels a bit too sensitive to file encodings(?) Wish there was output somewhere confirming it had found the ignore file, and output the contents, or something? or showed the full file path. It's really frustrating having to guess what's wrong.
In a bunch of auto-generated files within visual studio you really get thrown into the deep if something doesn't work by default; with azure, aks, kubernetes, docker-compose, visual studio, net core, helm, tiller, docker all at once, I have no idea what to type into google to get help with a problem, when any one or all could be broken.
Try running VS as Administrator.
I'm having similar issues here, and use context field as well:
version: '3.4'
services:
agent:
image: ${DOCKER_REGISTRY-}hello/world-agent:latest
build:
context: ../
dockerfile: Agent/Agent/Dockerfile
and my ignore file looks like:
.dockerignore
.env
.git
.gitignore
.vs
.vscode
docker-compose.yml
docker-compose.*.yml
*/bin
*/obj
*/.vs
And the error I see is:
PermissionError: [Errno 13] Permission denied: '\\\\?\\C:\\work\\src\\Agent\\.vs\\agent\\v16\\Server\\sqlite3\\db.lock'
I've added the */.vs and checked the encoding, and it's UTF-8, so everything looks fine there I think. What am I missing?
Make sure you stop all running containers.
And visual studio if you're running one.
On Fri., 10 May 2019, 2:47 am jherman, [email protected] wrote:
I'm having similar issues here, and use context field as well:
version: '3.4'
services: agent: image: ${DOCKER_REGISTRY-}hello/world-agent:latest build: context: ../ dockerfile: Agent/Agent/Dockerfile
and my ignore file looks like:
.dockerignore .env .git .gitignore .vs .vscode docker-compose.yml docker-compose.*.yml */bin */obj */.vs
And the error I see is:
PermissionError: [Errno 13] Permission denied: '\\?\C:\work\src\Agent\.vs\agent\v16\Server\sqlite3\db.lock'
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/1924#issuecomment-490980737, or mute the thread https://github.com/notifications/unsubscribe-auth/AA66DFBILL7DLBFZYCK4YFTPURITLANCNFSM4EZKTF7A .
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.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked