docker-compose failing in Azure DevOps Server with exit code 1, dockerd might not be running?

1.2k Views Asked by At

I'm trying to publish some code one of our developers has written as a docker-compose and I'm hitting a snag where the process is failing with exit code 1.

A bit about the environment...

Pipeline running in Azure DevOps Server Build agent is running on Windows Server 2016

When the pipeline runs, it errors out on the DockerCompose step I've set up. Here's some relevant log information...

"C:\Program Files\Docker\docker-compose.exe" -f C:\agent\_work\1\s\docker\docker-compose.yml -f C:\agent\.docker-compose.1672864292001.yml -p materialsdatabase up -d --build
error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dmaterialsdatabase%22%3Atrue%7D%7D": open //./pipe/docker_engine: Access is denied.
##[debug]Exit code 1 received from tool 'C:\Program Files\Docker\docker-compose.exe'
##[debug]STDIO streams have closed for tool 'C:\Program Files\Docker\docker-compose.exe'
##[debug]task result: Failed
##[error]The process 'C:\Program Files\Docker\docker-compose.exe' failed with exit code 1

I also tried running the command locally in an elevated terminal on the build box. It threw the following error, though it does appear that the file that it's complaining about does not exist. I'm assuming it's some kind of temp file so this might be a red herring.

"C:\Program Files\Docker\docker-compose.exe" -f C:\agent\_work\1\s\docker\docker-compose.yml -f C:\agent\.docker-compose.1672864292001.yml -p materialsdatabase up -d --build
CreateFile C:\agent\.docker-compose.1672779313403.yml: The system cannot find the file specified.

Upon seeing this I assume that the docker daemon isn't running and that's what's causing the issue. So I went to the build agent machine and tried running dockerd to force it to run. When I did that, I got the following output from dockerd...

time="2023-01-04T15:29:29.988530700-05:00" level=info msg="Starting up"
time="2023-01-04T15:29:30.034570000-05:00" level=info msg="Windows default isolation mode: process"
time="2023-01-04T15:29:30.259637100-05:00" level=info msg="Loading containers: start."
time="2023-01-04T15:29:30.373580700-05:00" level=info msg="Restoring existing overlay networks from HNS into docker"
time="2023-01-04T15:29:30.662499700-05:00" level=error msg="Resolver Setup/Start failed for container nat, \"error in opening name server socket listen udp 172.30.144.1:53: bind: The requested address is not valid in its context.\""
time="2023-01-04T15:29:31.662930000-05:00" level=error msg="Resolver Setup/Start failed for container nat, \"error in opening name server socket listen udp 172.30.144.1:53: bind: The requested address is not valid in its context.\""
time="2023-01-04T15:29:32.665870600-05:00" level=error msg="Resolver Setup/Start failed for container nat, \"error in opening name server socket listen udp 172.30.144.1:53: bind: The requested address is not valid in its context.\""
time="2023-01-04T15:29:33.688807800-05:00" level=info msg="Loading containers: done."
time="2023-01-04T15:29:33.696116400-05:00" level=info msg="Docker daemon" commit=9b96ce992b graphdriver(s)=windowsfilter version=20.10.9
time="2023-01-04T15:29:33.698066000-05:00" level=info msg="starting telemetry service"
time="2023-01-04T15:29:33.705958100-05:00" level=info msg="Daemon has completed initialization"
time="2023-01-04T15:29:33.773500600-05:00" level=info msg="API listen on //./pipe/docker_engine"

Rerunning the pipeline yields the same error as before. I have a few questions from this...

  1. Am I right to assume that this is an issue with dockerd not running when the pipeline is trying to execute?
  2. Are these errors in the dockerd start up relevant to what the pipeline is trying to do? Is there a way to verify what is actually working and what isn't?

Edit: I tried running the following, and am getting output listed below. What the heck is going on here?

C:\agent\_work\1\s>docker-compose -f docker\docker-compose.yml -p material-test-2-icamm up -d
error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dmaterial-test-2-icamm%22%3Atrue%7D%7D": open //./pipe/docker_engine: The system cannot find the file specified.
1

There are 1 best solutions below

1
On

Please check with the following things to see whether the issue can be resolved:

  1. Ensure the docker-compose can work when you manually run it on the agent machine. If it also does not work, the problem should be on the docker-compose file itself or the environment configuration on the agent machine. In this situation, it is not possible to ensure the docker-compose can work when running it in pipeline. You need to work with your developers to check the docker-compose file and the environment configuration.

  2. If the docker-compose can work when you manually run it on the agent machine. Try to install a new self-hosted agent on the agent machine. When setting up the new self-hosted agent and selecting the Authentication options, chose using your userName and password instead of your PAT (Personal Access Token) as the authentication. The userName and password are that you are using to login the agent machine.