Bamboo “cannot connect to Docker daemon”

My Bamboo build plan (running on an linux64 agent) has a stage to do a source code checkout from my GitHub repo, and then a stage to build an image with that Dockerfile, which looks like this:

set -o xtrace
set -o errexit
${bamboo_DOCKER_SIGNATURE} build ${bamboo_DOCKER_BUILD_EXTRAS} -t myname:${bamboo_buildNumber} -f Dockerfile .

The next stage I want is a script that pushes this image to my Docker registry (on Quay.io). The script I have so far is below, but the build fails with the error “Cannot connect to the Docker daemon. Is the docker daemon running on this host?”.

  • Docker daemon processes
  • bamboo agent and docker connectivity, need explanation
  • Why docker is launching so many daemon processes?
  • DevOps vs Docker
  • error response from daemon: no such container: dionaea
  • How do I not create docker container logs?
  • set -o xtrace
    set -o errexit
    
    # service docker start  # commented out b/c this did not solve the docker daemon issue
    
    # This is where the build fails:
    docker login -e="." -u=${bamboo.QUAY_ROBOT_name} -p=${bamboo.QUAY_ROBOT_token} quay.io
    
    # Push the image to 'my_repo' in the Quay.io organization 'my_team', with tag 'bamboo_build'
    docker push quay.io/my_team/my_repo:bamboo_build${bamboo_buildNumber}
    

    FWIW the same login command works as expected from my local command line. How can I remedy this? Also, using Bamboo’s built in Docker task does not work — it’s unable to login to the registry, but for some reason does not have the “docker daemon” issue. Thank you in advance for any help!

  • Using Docker for local development replacing Vagrant
  • Docker refusing to run bash
  • Docker-compose invalid bind mount spec “/rootfs:ro”: invalid volume specification
  • Issue regarding the Dockerfile creation
  • docker is great for run-anywhere but what about the machines to host docker?
  • Docker Daemon not running
  • One Solution collect form web for “Bamboo “cannot connect to Docker daemon””

    The trick was to use the Bamboo variable ${bamboo_DOCKER_SIGNATURE} instead of docker. This variable says to use a specific host–i.e., docker -H <host address>.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.