Running Docker commands in Bitbucket Pipelines

Alpha Feature - this feature is currently under development and only available to Pipelines Alpha users.

The capabilities and configuration of this feature may change as development proceeds. To provide feedback on this feature, please see Pipelines Alpha.

Bitbucket Pipelines allows you to run Docker commands within your build pipeline, creating Docker images from a Dockerfile in your repository and pushing it to a Docker registry.

Available Docker commands

Inside your Pipelines script, you can run the following Docker commands:

  • docker login
  • docker build
  • docker tag
  • docker pull
  • docker push

See the Docker command line reference for information on how to use these commands. Other commands, such as docker run, are currently forbidden for security reasons on our shared build infrastructure.

Note that if you've been running commands against your own Docker daemon, this new feature doesn't prevent you from continuing to do that.

Pushing to a private registry

To push images to a private registry, you need to use docker login to authenticate prior to calling docker push. See the limitations below for more information.

Alpha limitations

We have the following limitations with the alpha version of this feature:

  • Pipelines does not currently wait for Docker to be available before starting your build script. 
  • Private registries require a call to docker login even if you have provided credentials to retrieve the build environment docker image in your Pipelines YAML. This is because these credentials are not currently shared with the Docker daemon which we independently start for you.

Please let us know if any of these limitations cause problems for you, as we're still determining what functionality to include in this feature.

Alpha feedback

If you have any feedback about this alpha feature, please email us at pipelines-feedback@atlassian.com.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport