Running a Docker container in Bamboo
By default, the task's working directory is mounted and used as the Docker container's working directory, but you can specify your own settings.
By default, the container is removed on completion of the task, but you can select Detach container to have the container continue to run after a deployment project completes. Containers can be linked to detached containers started by preceding tasks in a job by selecting the Link to detached containers option.
Note that a non-detached container that fails to start will not be removed when the Bamboo task completes. See this KB article for more details.
Before you begin
- Make sure you have Docker installed. We advise to use the most recent version.
Define a Docker capability in Bamboo. See Defining a new Docker capability
- If you're using Bamboo on Windows, you can't run Docker commands directly from the Windows command line. To use Docker tasks with Bamboo Windows, run Docker Machine.
To run a Docker container in Bamboo:
- In the job configuration screen, select Add task.
- Search for the Docker tasks type and select it.
- (optional) For future reference, add a Task description.
- (optional) Use the Disable this task checkbox to control whether your task gets run.
- (optional) Use the Add condition to task checkbox to make task run only when a certain condition is met.
You can find conditions on Atlassian Marketplace or implement your own. Select the Run a Docker container command and complete the settings. See more information about the settings below: