vscode-docker icon indicating copy to clipboard operation
vscode-docker copied to clipboard

docker run - too many colons

Open jenkins1967 opened this issue 4 years ago • 2 comments

Does anyone know why I'm getting this error:

 *  Executing task: docker-run: debug 

> docker run -dt -P --name "hellocodeapi-dev" -e "DOTNET_USE_POLLING_FILE_WATCHER=1" -e "ASPNETCORE_ENVIRONMENT=Development" --label "com.microsoft.created-by=visual-studio-code" -v "C:\projects\DockerAndNet\ApiWithDockerDemo\VisualCode\HelloCode.Api:C:\app:rw" -v "c:\projects\DockerAndNet\ApiWithDockerDemo\VisualCode\HelloCode.Api:C:\src:rw" -v "C:\Users\jenki\.vsdbg:C:\remote_debugger:ro" -v "C:\Users\jenki\.nuget\packages:C:\.nuget\packages:ro" -v "C:\Users\jenki\.nuget\packages:C:\Users\ContainerUser\.nuget\packages:ro" "hellocodeapi:dev" <

docker: Error response from daemon: mount denied:
the source path "\\projects\\DockerAndNet\\ApiWithDockerDemo\\VisualCode\\HelloCode.Api:C:\\app:rw"
too many colons.
See 'docker run --help'.

I'm using the extension to try to run a simple sample project in a docker container as part of a training module. I'm new to docker and I don't know how to get the extension to work correctly.

Here's the appropriate part of launch.json:

{
            "name":"Docker .NET Core Launch",
            "type": "docker",
            "request":"launch",
            "preLaunchTask": "docker-run: debug",
            "netCore": {
                "appProject": "${workspaceFolder}/HelloCode.Api.csproj"
            },
            "dockerServerReadyAction": {
                "uriFormat":"http://localhost:%s/swagger"
            }
      }

Any ideas? Thanks.

jenkins1967 avatar Oct 26 '22 21:10 jenkins1967

Can you share your Dockerfile and tasks.json as well? It looks like your task is configured for Windows containers (based on the right side of the paths of the volume mappings) but you are in Linux container mode in Docker Desktop. I get the same error if I try to do a volume mount with a Windows container path syntax but using a Linux image (alpine):

PS D:\Sandbox> docker run -dt -v D:\Sandbox:C:\src:ro alpine
docker: Error response from daemon: mount denied:
the source path "\\Sandbox:C:\\src:ro"
too many colons.
See 'docker run --help'.

bwateratmsft avatar Oct 27 '22 15:10 bwateratmsft

@bwateratmsft, You have a Big Brain. That was the problem! I would swear I changed to windows mode on installation, but apparently not. Thanks.

jenkins1967 avatar Oct 27 '22 17:10 jenkins1967