Configuring Docker agent in YAML Bamboo specs
Asked by thenathanjones:

Hi,

I'm migrating a build from using Jenkins with a Jenkinsfile to Bamboo. I'm looking to use the YAML version of configuring as opposed to Java. I would like to run my tasks in Docker agents as I was doing previously, but I can't work out, if it's even possible, how to pass arguments.

This is what I have currently in Jenkins which I'm looking to replicate:

```
 agent { docker { image 'node:9.11-alpine' args '-v $HOME/.m2:/root/.m2 -e HTTPS_PROXY -e HTTP_PROXY -e NO_PROXY' } }
```

I can specify the image in my bamboo.yaml very simply using the following on my job:

```
dockerImage: node:9.11-alpine
```

This doesn't get me all the way, as I'm not able to pass through the shared volume for the Maven cache, and more importantly the proxy variables from the host.

Is what I'm doing even possible? If not, is there a workaround? If not, is this on the roadmap for features to be added?

Cheers,

Nathan


Answers:
author: Robert W
body: Nathan,

At this time it is not possible to pass anything other than just the dockerImage for use in Docker Runner using YAML specs.

If you need more control over the arguments passed to the Docker container, I suggest you try out Java Specs instead. Java specs allows for much more complexity in the build definitions.

[Docker Volumes: Bamboo Java Specs](https://docs.atlassian.com/bamboo-specs-docs/6.5.0/specs-java.html#volumes)

Cheers, Robert Watson Dev Tools Support \| Atlassian

comments: author: thenathanjones
body: Hi Robert, thanks for the reply. That's a shame as I'd much prefer to use YAML and avoid people creating crazy things in build pipelines.

Is there any plans in the roadmap to add this functionality to the YAML specs?


author: Robert W
body: Nathan,

I don't know if this functionality is currently on the roadmap or not.

I have, however, created a feature request for this capability here:

[BAM-19952: Pass arguments to Docker Runner with YAML specs](https://jira.atlassian.com/browse/BAM-19952)

Please be sure to watch it, and vote on it, so that you're notified if this is implemented in a future release. For your reference, you can find our policy on how we prioritize feature and improvement requests at [this page](https://confluence.atlassian.com/display/DEV/Implementation+of+New+Features+Policy). You can also add a comment to the feature request to explain your specific use-case to the developers.

I have also added a link to this post so that the developers can reference it if necessary.

Thank you, Robert Watson Dev Tools Support \| Atlassian


author: thenathanjones
body: Hi Robert,

I've just been looking through the documentation for the Java Specs and the corresponding API documentation [here](https://docs.atlassian.com/bamboo-specs/6.5.0/com/atlassian/bamboo/specs/api/model/docker/DockerConfigurationProperties.html).

It does cover the volume creation for the Maven cache. This is nice thanks.

Unfortunately it does not resolve my principal problem which is to pass through build arguments, in my case proxy configuration. It's set on my host agent, but without being passed through I'm unable to build things that aren't able to be proxied through our Nexus server.

Can you think of any workarounds for getting this context to the build agent?

Cheers,

Nathan