Volume mount path error

I am using docker desktop in my laptop and i am trying to map the volume as below so that Azure DevOps container agent will be ready. But due to some volume path error. I am getting following error. Please suggest. and you can see the respective files in the respective folder.

Am i missing something? Please suggest

A. Why are you using double backslashes?

B. Try doing /c/ or //c/ instead of C:/

C. Try surrounding the path with quotes

What is the version of your Docker Desktop and the Docker CE in it? Please, share the output of

docker version

not as a picture, but a text. Use code blocks surrounded by three backticks before and after like

```
output here
```

\\.\pipe\docker_engine is a named pipe, not a file. The error you are experiencing existed, but Docker supports mounting named pipes on Windows. You could use the long syntax

docker run ... --mount type=npipe,source=\\.\pipe\docker_engine,target=\\.\pipe\docker_engine ...

but my version recognizes it is an named pipe and sets the type automatically.

Docker Desktop 4.34.0 and Dcoker CE (Engine) 27.2.0

Regarding double backslashes, named pipes require that, but according to the documentation, bind mounting files doesn’t unless you work in Git Bash

https://docs.docker.com/engine/storage/bind-mounts/#start-a-container-with-a-bind-mount

If you’re on Windows, see also Path conversions on Windows.

This is because the \ character has a special meaning in Git Bash. If you are using Git Bash, you must neutralize it using \\ :

Here is the docker version

PS C:\Users\LAPSAdmin> docker --version
Docker version 26.1.4, build 5650f9b
PS C:\Users\LAPSAdmin> cd I:\DockerLinuxAgent
PS I:\DockerLinuxAgent> ls


    Directory: I:\DockerLinuxAgent


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          9/7/2024   3:46 PM           1881 Dockerfile
-a----          9/7/2024   3:46 PM           2448 start.sh

and you can see the content in the respective path above, so what mistake I am doing below ? could you please correct, I tried again but still error coming up.

PS I:\DockerLinuxAgent> docker run -d -v I:\\DockerlinuxAgent:c\\agent\\work   --name cagentsept8 --hostname cagent8 --restart unless-stopped -v \\.\pipel\docker_engine:\\.\pipe\docker_engine -e VSTS_AGENT_INPUT_TOKEN=pqwm5oonrmm5o57uvod4msgndaohczubqmg5hxbdr6ydjzpfc3qq  -e VSTS_AGENT_INPUT_POOL=YOUR_POOL devops:agentv2
docker: Error response from daemon: \\.\pipel\docker_engine%!(EXTRA string=is not a valid Windows path).
See 'docker run --help'.
PS I:\DockerLinuxAgent>

Please, edit your post and

Also you should use code blocks for any terminal output, command or code.

The </> button, but I shared how you could write the code block manually without clicking on buttons. You can see our full formatting guide here:

I have edited. Hope that is fine. Thank you.

Thank you for adding code blocks, however, you don’t have to put everything into code blocks so I fixed it for you know. I’m sure, next time you will do it correctly.

That is just the engine version.

But, even the engine version shows you are using at least a little bit older Desktop. Maybe there was a bug in that. I recommend updating the desktop to the latest v4.34.x

Have you tried the mount option I suggested?

PS I:\DockerLinuxAgent> docker version
Client:
 Version:           26.1.4
 API version:       1.45
 Go version:        go1.21.11
 Git commit:        5650f9b
 Built:             Wed Jun  5 11:29:54 2024
 OS/Arch:           windows/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.31.1 (153621)
 Engine:
  Version:          26.1.4
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       de5c9cf
  Built:            Wed Jun  5 11:29:22 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.33
  GitCommit:        d2d58213f83a351ca8f528a95fbd145f5654e957
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
PS I:\DockerLinuxAgent> docker run -d `
>>     -v I:\DockerLinuxAgent:C:\agent\work `
>>     --name cagentsept8 `
>>     --hostname cagent8 `
>>     --restart unless-stopped `
>>     -e VSTS_AGENT_INPUT_TOKEN=pqwm5oonrmm5o57uvod4msgndaohczubqmg5hxbdr6ydjzpfc3qq `
>>     -e VSTS_AGENT_INPUT_POOL=YOUR_POOL `
>>     devops-image:v2
docker: Error response from daemon: invalid mode: \agent\work.```

I updated now and still the same error as above.

You got a totally different error. how is that the same? Jut remove the drive lettter from the destination. You don’t need that. If I remember correctly, you couldn’t mount a folder anywhere else than C and anything after the colon is the mode like “ro”, meaning read-donly. And "\agent\work` is not a mode.

And again, don’t put your own thoughts into code blocks, only the parts where you share anything with special characters which would be interpreted by the forum’s markdown filter. We will not recognize what you are saying and what is the part of the error message. At least not immediately. I fixed it again.

Okay, I could fix now. but I am seeing that agent is not available in the pool section of Azure DevOps even I see container created.