Spencer Ruport
Spencer Ruport

Reputation: 35117

Having trouble understanding volumes in Docker using Docker Toolbox in Windows during a build

So the error I keep running into is:

COPY failed: stat /mnt/sda1/var/lib/docker/tmp/docker-builderXXXXXXXXX/MyProjectFolder/MyProjectFile.csproj

I've done a lot of googling and the common issues I'm seeing are things like path issues where the file exists and a simple adjustment to the path fixes the issue. In my case when I run bash inside the container and ls /mnt it's completely empty. There is no sda1 or anything.

So I have two questions:

  1. What step in the build process is responsible for provisioning/mounting this docker-builder folder inside the container? If I knew where that was happening I might be able to figure out why it's not working.
  2. Assuming I can't get that working I figured perhaps I could mount the folder myself but the docker build command doesn't have a -v switch so I'm not sure how to accomplish that either.

Hoping someone can give me a nudge in the right direction here. I can see the problem I just have no idea what configuration/settings/whatever I need to mess with to get it working.

EDIT: As I continue to poke around I did notice the first line of the docker build command is Sending build context to Docker daemon xxxMB. The size matches that of the project folder so the "Docker daemon" is getting the appropriate files. I have already tried doing a RUN find / -name "*.csproj" (along with some other searches) command but it returns nothing. Is the daemon responsible for mounting the context in the container? What would cause that to (silently) fail?

Upvotes: 2

Views: 38

Answers (1)

Spencer Ruport
Spencer Ruport

Reputation: 35117

So once I noticed the "Docker daemon" I started pulling on that thread and learned about the ADD command which seems to be the command for copying the build context to the container. I didn't see it anywhere in my Dockerfile so I gave it a try and suddenly I had access to the project files inside the container. I adjusted the failed COPY command to use this path and everything built as expected. I'm not sure why the Visual Studio project template doesn't do this for me but whatever.

Pretty excited to be past this hurdle.

Upvotes: 2

Related Questions