https://prefect.io logo
#prefect-community
Title
# prefect-community
b

Brad

04/06/2022, 10:18 PM
Hey team - having some troubles running docker tasks in a docker agent on windows (dind) ..
I’m trying to mount the docker socket without any luck - I’ve tried basically every combination I can think of for
--volume //var/run/docker.sock
Starting docker agent with
prefect agent docker start --volume //var/run/docker.sock
then running a flow with some docker tasks
Errors are typically one of two issues:
Copy code
docker.errors.APIError: 500 Server Error for <http+docker://localnpipe/v1.41/containers/create?name=super-jacamar>: Internal Server Error ("b'\\\\var\\run\\docker.sock%!(EXTRA string=is not a valid Windows path)'")
or
Copy code
docker.errors.APIError: 500 Server Error for <http+docker://localnpipe/v1.41/containers/create?name=awesome-nyala>: Internal Server Error ("b'mount denied:\nthe source path "\\\\\\\\var\\\\run\\\\docker.sock:\\\\var\\\\run\\\\docker.sock:/var/run/docker.sock:/var/run/docker.sock:rw"\ntoo many colons'")
a

Anna Geller

04/06/2022, 10:31 PM
This is hard. I think @Kevin Kho may help you later since he's been trying to do something with the docker-sock recently. Are you sure mounting the sock is necessary? I think it would be much easier to start a local agent instead of a docker agent because then your Docker tasks will spin up everything as containers anyway, and this way you can avoid running docker-in-docker and having to deal with the docker socket
b

Brad

04/06/2022, 10:33 PM
Good point @Anna Geller - the reason for the docker agent is so I can palm off the run environment to my docker images
👍 1
k

Kevin Kho

04/06/2022, 10:36 PM
Uhh I cannot 😆. This is hard. So I can say based on this archived issue that
-v /var/run/docker.sock:/var/run/docker.sock
reportedly works. That seems close to what you tried and I am just wondering if it’s something to do with Windows here. You are running Docker on Windows?
b

Brad

04/06/2022, 10:37 PM
yeah running docker on windpws
k

Kevin Kho

04/06/2022, 10:37 PM
Yeah it really seems windows just doesn’t like how the path is handled
b

Brad

04/06/2022, 10:38 PM
According to various SO posts,
--volume //var/run/docker.sock:/var/run/docker.sock
should work
but then it fails the prefect volume parsing I believe (just trying to rerun it again)
k

Kevin Kho

04/06/2022, 10:46 PM
Ah I see you mean on the agent? I can understand if it fails on the agent code level after you set this
b

Brad

04/06/2022, 10:48 PM
yep
so the error is this guy
Copy code
docker.errors.APIError: 500 Server Error for <http+docker://localnpipe/v1.41/containers/create?name=awesome-nyala>: Internal Server Error ("b'mount denied:\nthe source path "\\\\\\\\var\\\\run\\\\docker.sock:\\\\var\\\\run\\\\docker.sock:/var/run/docker.sock:/var/run/docker.sock:rw"\ntoo many colons'")
if I try and run with just the host volume (
prefect agent docker start --volume //var/run/docker.sock
) then I get
Copy code
<http+docker://localnpipe/v1.41/containers/create?name=mottled-mole>: Internal Server Error ("b'\\\\var\\run\\docker.sock%!(EXTRA string=is not a valid Windows path)'
k

Kevin Kho

04/06/2022, 11:06 PM
I think this would require changes to the Docker Agent code to get working
b

Brad

04/06/2022, 11:12 PM
Yep sounds like it. I'll raise an issue
k

Kevin Kho

04/07/2022, 1:01 AM
Nice! We’ll see what they say
8 Views