Docker task not running in Windows environment (Local)
Asked by Kelvin:

Hi, I have issues running Docker tasks in a Windows environment.

The docs stated "To use the Docker task with a Windows Bamboo server, run [Docker Machine](https://docs.docker.com/engine/installation/windows/)." Would like more elaboration to this. I have Docker Toolbox running locally and can build and run docker images on my local machine.

The error logs state the following:

```
2018-02-27 10:21:57,283 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [TaskResultBuilder] RCD-RCP-JOB1-16: Failing task since return code of [C:\Program Files\Docker Toolbox\docker.exe build --no-cache=true --force-rm=true --tag=reaction-dev C:\Users\Kelvin\bamboo-home\xml-data\build-dir\RCD-RCP-JOB1] was 1 while expected 0
2018-02-27 10:21:57,288 ERROR [17-BAM::Default Agent::Agent:pool-32-thread-1] [TaskExecutorImpl] Error occurred while running Task 'Build RC(3)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli.
com.atlassian.bamboo.task.TaskException: Failed to execute task
 at com.atlassian.bamboo.plugins.docker.service.BuildService.execute(BuildService.java:53)
 at com.atlassian.bamboo.plugins.docker.tasks.cli.DockerCliTask.execute(DockerCliTask.java:70)
 at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:285)
 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:224)
 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:285)
 at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:112)
 at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:71)
 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:203)
 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:175)
 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:122)
 at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:117)
 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126)
 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
 at java.lang.Thread.run(Unknown Source)
Caused by: com.atlassian.bamboo.docker.DockerException: Error running Docker build command
 at com.atlassian.bamboo.plugins.docker.client.DockerCmd.build(DockerCmd.java:106)
 at com.atlassian.bamboo.plugins.docker.service.BuildService.execute(BuildService.java:40)
 ... 17 more
Caused by: com.atlassian.utils.process.ProcessException: Error executing C:\Program Files\Docker Toolbox\docker.exe build --no-cache=true --force-rm=true --tag=reaction-dev C:\Users\Kelvin\bamboo-home\xml-data\build-dir\RCD-RCP-JOB1
 at com.atlassian.bamboo.plugins.docker.process.DockerTaskProcessService.execute(DockerTaskProcessService.java:62)
 at com.atlassian.bamboo.plugins.docker.client.DockerCmd.build(DockerCmd.java:104)
 ... 18 more
2018-02-27 10:21:57,301 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [DefaultErrorHandler] Recording an error: Error occurred while running Task 'Build RC(3)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli. : RCD-RCP-JOB1 : Failed to execute task
2018-02-27 10:21:57,315 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [ExecuteBuildTask] RCD-RCP-JOB1-16: Running post build plugin 'NCover Results Collector'
2018-02-27 10:21:57,318 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [NCoverBuildProcessor] inside NCoverBuildProcessor.call()
2018-02-27 10:21:57,318 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [ExecuteBuildTask] RCD-RCP-JOB1-16: Running post build plugin 'Artifact Copier'
2018-02-27 10:21:57,327 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [BuildArtifactPostProcessor] Copying the build artifacts for build: RCD-RCP-JOB1-16
2018-02-27 10:21:57,329 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [ExecuteBuildTask] RCD-RCP-JOB1-16: Running post build plugin 'npm Cache Cleanup'
2018-02-27 10:21:57,337 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [ExecuteBuildTask] RCD-RCP-JOB1-16: Running post build plugin 'Clover Results Collector'
2018-02-27 10:21:57,343 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [ExecuteBuildTask] RCD-RCP-JOB1-16: Running post build plugin 'Docker Container Cleanup'
2018-02-27 10:21:57,344 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [ExecutionPhaseServiceImpl] Reactioncommerce Docker - Reactioncommerce Plan - Default Job #16 (RCD-RCP-JOB1-16) execution finished
2018-02-27 10:21:57,350 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [LocalBuildResultProcessor] Processing build result RCD-RCP-JOB1-16...
2018-02-27 10:21:57,354 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [ExecutionPhaseServiceImpl] Reactioncommerce Docker - Reactioncommerce Plan - Default Job #16 (RCD-RCP-JOB1-16) execution finished
2018-02-27 10:21:57,385 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [PlanStatePersisterImpl] RCD-RCP-JOB1-16: Generating build results summary...
2018-02-27 10:21:57,416 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [PlanStatePersisterImpl] Updating delta states of build following RCD-RCP-JOB1-16
2018-02-27 10:21:57,429 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [CurrentlyBuildingContainer] removeCurrentlyBuilding called for [RCD-RCP-JOB1-16]
2018-02-27 10:21:57,445 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [DefaultBuildAgent] Changing context: RCD-RCP-JOB1-16 -> null on Default Agent/1e688b3a
2018-02-27 10:21:57,446 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [BuildAgentControllerImpl] Agent 'Default Agent' ready to take build from queue...
2018-02-27 10:21:57,450 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [BuildAgentControllerImpl] Agent 196609 checking build queue for executables...
Security framework of XStream not initialized, XStream is probably vulnerable.
2018-02-27 10:21:57,466 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-12] [BuildCompletedEventListener] Running build post actions 'RCD-RCP-JOB1'
2018-02-27 10:21:57,478 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-13] [ChainExecutionManagerImpl] Plan RCD-RCP-16: Reactioncommerce Docker - Reactioncommerce Plan has finished executing
2018-02-27 10:21:57,478 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-7] [EnvironmentDependencyListener] Deployments not triggered since chain stage failed
2018-02-27 10:21:57,480 INFO [19-IndexerService.indexer:pool-35-thread-1] [DefaultBuildResultsIndexer] Indexed RCD-RCP-JOB1-16
2018-02-27 10:21:57,486 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-13] [PlanStatePersisterImpl] Updating delta states of build following RCD-RCP-16
2018-02-27 10:21:57,513 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-13] [PostChainIndexAction] Indexing RCD-RCP-16
2018-02-27 10:21:57,553 INFO [19-IndexerService.indexer:pool-35-thread-1] [DefaultBuildResultsIndexer] Indexed RCD-RCP-16
2018-02-27 10:21:57,562 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-11] [DependencyChainListener] Checking children plans of [RCD-RCP] for plan RCD-RCP-16
2018-02-27 10:21:57,565 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-11] [DependencyChainListener] Dependant builds not checked since plan failed
2018-02-27 10:21:57,564 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-6] [EnvironmentDependencyListener] Deployments not triggered since chain failed
2018-02-27 10:21:57,569 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-11] [DependencyChainListener] Finished checking children plans of 'Reactioncommerce Docker - Reactioncommerce Plan' for plan RCD-RCP-16
```

Thanks in advance

Kelvin


Answers:
author: Kelvin
body: Managed to get the docker task running locally by restarting the local docker VM, and the starting the Bamboo server.


Tags: docker

windows