How to run docker command in docker container for appveyor server docker builds?

Turgay Özgür's Avatar

Turgay Özgür

10 Jul, 2019 11:43 AM


I'm setting up a new appveyor server and trying to build docker images with using the docker build feature. But when I try to run docker commands in my custom build container, got the error that shown below.

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I think the appveyor server should run our custom build containers with the volume option that point the docker.sock.

sudo docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker name-of-the-custom-image bash

  1. Support Staff 1 Posted by Feodor Fitsner on 10 Jul, 2019 04:27 PM

    Feodor Fitsner's Avatar

    Hi Turgay,

    Thanks for trying out AppVeyor Server!

    I guess Docker was installed after AppVeyor Server. This case appveyor user should be added to docker security group to be able to run Docker commands without sudo:

    sudo usermod -aG docker appveyor

    Restart AppVeyor after that:

    systemctl restart appveyor-server

    More info here:

  2. Support Staff 2 Posted by Feodor Fitsner on 10 Jul, 2019 04:32 PM

    Feodor Fitsner's Avatar

    Oh, scratch it! Looks like I didn't get your question in the first place.

    Right, in order to run docker inside Docker container builds Docker socket should be mounted to the container.

    You can modify Docker cloud settings under Account -> Build environment and put the following into Custom Docker command arguments:

    -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker

    Well, that's going to work for Linux builds, of course. Hope that helps.

  3. 3 Posted by Turgay Özgür on 11 Jul, 2019 01:01 PM

    Turgay Özgür's Avatar

    Thank you. It works like charm.

  4. 4 Posted by Ilya Finkelshte... on 11 Jul, 2019 04:57 PM

    Ilya Finkelshteyn's Avatar

    Thank you for the update, and for answering on SO :)

  5. Ilya Finkelshteyn closed this discussion on 11 Jul, 2019 04:57 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac