Cannot connect to the Docker daemon on TeamCity build agent in AWS

1.5k views Asked by At

I've got build agent machine on Amazon Linux AMI. It has docker container jetbrains/teamcity-agent:latest. I can see build agent in TeamCity panel.

When I'm trying to run build with docker build/push commands I'm getting this error

Cannot login to registry docker.io (new); cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?; exit code 1 (Step: docker build (Docker))

What's wrong with teamcity-agent?

1

There are 1 answers

0
Christian Hujer On

I guess that the jetbrains/teamcity-agent:latest will be running as a user that does not have docker permissions. Either the user that runs the commands in this image needs to be added to the group docker, or via ACLs be given permission to the docker socket /var/run/docker.sock. Note that this is root-equivalent.