Docker task in a job running with Docker runner

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem 1: "<PATH>/docker: not found"

The build fails with:

simple  21-May-2018 11:42:35  Starting task 'Docker' of type 'com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli'
command 21-May-2018 11:42:35  Beginning to execute external process for build 'Docker test - Default Job #3 (DT-DNF-JOB1-3)'\n ... running command line: \n/Users/user/atlassian/bamboo/6.5.0/install/temp/runInDocker2732808886495956167.sh /usr/local/bin/docker build --force-rm=true --tag=test /Users/user/atlassian/bamboo/6.5.0/home/xml-data/build-dir/DT-DNF-JOB1\n ... in: /Users/user/atlassian/bamboo/6.5.0/install/temp\n
error 21-May-2018 11:42:35  /tmp/runInDocker7178378869512827680.sh: 4: /tmp/runInDocker7178378869512827680.sh: /usr/local/bin/docker: not found
simple  21-May-2018 11:42:35  Failing task since return code of [/Users/user/atlassian/bamboo/6.5.0/install/temp/runInDocker2732808886495956167.sh /usr/local/bin/docker build --force-rm=true --tag=test /Users/user/atlassian/bamboo/6.5.0/home/xml-data/build-dir/DT-DNF-JOB1] was 127 while expected 0
error 21-May-2018 11:42:35  Error occurred while running Task '(1)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli.
error 21-May-2018 11:42:35  com.atlassian.bam
boo.task.TaskException: Failed to execute task
error 21-May-2018 11:42:35    at com.atlassian.bamboo.plugins.docker.service.BuildService.execute(BuildService.java:53)

Problem 2: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock"

The build fails with:

simple  21-May-2018 12:17:59  Starting task 'Hello-world' of type 'com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli'
simple  21-May-2018 12:17:59  Running image name (hello-world)
command 21-May-2018 12:17:59  Beginning to execute external process for build 'Docker test - Default Job #10 (DT-DNF-JOB1-10)'\n ... running command line: \n/Users/user/atlassian/bamboo/6.5.0/install/temp/runInDocker3551531651881180730.sh /usr/local/bin/docker run --volume /Users/user/atlassian/bamboo/6.5.0/home/xml-data/build-dir/DT-DNF-JOB1:/data --workdir /data --rm hello-world\n ... in: /Users/user/atlassian/bamboo/6.5.0/install/temp\n
error 21-May-2018 12:18:00  /usr/local/bin/docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
error 21-May-2018 12:18:00  See '/usr/local/bin/docker run --help'.
error 21-May-2018 12:18:00  Error occurred while running Task 'Hello-world(2)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli.
error 21-May-2018 12:18:00  com.atlassian.bamboo.task.TaskException: Failed to execute task
error 21-May-2018 12:18:00    at com.atlassian.bamboo.plugins.docker.service.RunService.execute(RunService.java:75)

Workaround (Problems 1 and 2)

Avoid using docker runner for docker tasks:

  • In Plan configuration >> Stages >> (Affected Job) >> Docker,  select Run this job in: Agent environment instead of the default Docker container option.* 
  • Alternatively, a new Job can be created just to run docker tasks. This job will need to use the Agent environment runner instead of a Docker container.
Last modified on May 23, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.