Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-17729

Unable to "Build Docker image" from Docker task

XMLWordPrintable

      Summary

      Unable to "Build Docker image" from Docker task

      Resolution

      Problem is fixed in Bamboo 5.13.0.1. In case you can't upgrade please download bamboo-docker-plugin 5.10.3 from https://bitbucket.org/atlassian/bamboo-docker-plugin/downloads and install it in Bamboo via Administration / Manage addons

      Steps to Reproduce

      1. Install Docker
      2. Set the docker capability on Bamboo
      3. Create a plan and add the docker task to it
      4. Set the docker task configuration as the following:
      5. Run the build

      Expected Results

      The new image is built and added to the image repository.

      Actual Results

      When running Bamboo's Docker task, the following error gets thrown.

      build log
      error	04-Jul-2016 19:35:54	invalid argument "\"ubuntu:latest\"" for --tag="ubuntu:latest": Error parsing reference: "\"ubuntu:latest\"" is not a valid repository/tag
      error	04-Jul-2016 19:35:54	See 'docker build --help'.
      simple	04-Jul-2016 19:35:54	Failing task since return code of [/usr/local/bin/docker build --force-rm=true --tag="ubuntu:latest" /opt/atlassian/home/atlassian-bamboo-5.12.2.1/xml-data/build-dir/PROJ-DOC-JOB1] was 1 while expected 0
      error	04-Jul-2016 19:35:54	Error occurred while running Task '(1)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli.
      error	04-Jul-2016 19:35:54	com.atlassian.bamboo.task.TaskException: Failed to execute task
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.plugins.docker.service.BuildService.execute(BuildService.java:53)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.plugins.docker.tasks.cli.DockerCliTask.execute(DockerCliTask.java:60)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$272(TaskExecutorImpl.java:317)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:246)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:317)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:118)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:74)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:215)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:139)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:130)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:221)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:129)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:137)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:51)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
      error	04-Jul-2016 19:35:54		at java.lang.Thread.run(Thread.java:745)
      error	04-Jul-2016 19:35:54	Caused by: com.atlassian.bamboo.plugins.docker.client.DockerException: Error running Docker build command
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.plugins.docker.client.DockerCmd.build(DockerCmd.java:189)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.plugins.docker.service.BuildService.execute(BuildService.java:40)
      error	04-Jul-2016 19:35:54		... 17 more
      error	04-Jul-2016 19:35:54	Caused by: com.atlassian.utils.process.ProcessException: Error executing /usr/local/bin/docker build --force-rm=true --tag="ubuntu:latest" /opt/atlassian/home/atlassian-bamboo-5.12.2.1/xml-data/build-dir/PROJ-DOC-JOB1
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.plugins.docker.process.DockerTaskProcessService.execute(DockerTaskProcessService.java:60)
      error	04-Jul-2016 19:35:54		at com.atlassian.bamboo.plugins.docker.client.DockerCmd.build(DockerCmd.java:185)
      error	04-Jul-2016 19:35:54		... 18 more
      

      Running the same command from Terminal works successfully:

      /usr/local/bin/docker build --force-rm=true --tag="ubuntu:latest" /opt/atlassian/home/atlassian-bamboo-5.12.2.1/xml-data/build-dir/PROJ-DOC-JOB1
      

      Notes

      $ docker images
      REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
      ubuntu              latest              0f192147631d        5 days ago          132.8 MB
      

      Workaround

      1. Some customers have reported that downgrading Docker to 1.11 corrected the issue for them.
      2. Avoid using the Docker task and use the script task instead.

              moles Marcin Oles
              dsantos Daniel Santos (Inactive)
              Votes:
              9 Vote for this issue
              Watchers:
              19 Start watching this issue

                Created:
                Updated:
                Resolved: