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

Allow configuring default volumes for Docker Runner

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • Docker, Docker Runner
    • None
    • 2
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      Problem Definition

      When running Bamboo in Docker and trying to use Docker Runner one might need to change the default volume mounts (e.g. for mounting ${bamboo.working.directory} and ${bamboo.tmp.directory}) for all builds and deployments on the system.

      In order to use Docker Runner when Bamboo itself is being run in Docker, you need to mount the docker socket of the host into the container. However, this means that every time Bamboo issues docker run commands, those are sent to the host to actually be run, including volume mounts. Because Bamboo will try to mount internal paths which the host may not have or recognise, the default mounts for ${bamboo.working.directory} and ${bamboo.tmp.directory} will fail.

      This can have a number of unintended side effects, such as not being able to run script tasks (which are generated into Bamboo's temp directory and then cannot be found by the Docker Runner container), Docker Runner containers not having access to the real build dir etc.

      Suggested Solution

      Allow setting default values for volume mounts that are used for all new build and deployment plans

      Workaround

      You can manually configure each build and deployment plan with the correct volume mapping, and ensure the equivalent paths are mounted to the Bamboo container on the host.

      For example, given a Bamboo instance started like this:

      docker run -d \
          --name bamboo \
          -p 8085:8085 \
          -p 54663:54663 \
          -v bambooHome:/var/atlassian/application-data/bamboo \
          -v /path/to/my/bamboo/build-dir:/var/atlassian/application-data/bamboo/xml-data/build-dir \
          -v /path/to/my/bamboo/temp:/var/atlassian/application-data/bamboo/temp \
          -v /var/run/docker.sock:/var/run/docker.sock \
          atlassian/bamboo:version-with-docker-installed
      

      (Where Bamboo's build dir and temp dir have both been mounted to folder locations on the host, as well as mounting the host's docker Socket)

      You can edit the Volumes in a given plan's Docker configuration with the following values:

      Host directory Container directory
      /path/to/my/bamboo/build-dir ${bamboo.working.directory}/..
      /path/to/my/bamboo/temp ${bamboo.tmp.directory}

      In this configuration, everything works as expected.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dchevell Dave Chevell
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: