Using Docker commands in Bitbucket Pipelines
If you have a Dockerfile in your Bitbucket repository, you can use Bitbucket Pipelines to build the image and push it to your Docker repository. You can do this by executing Docker commands from within the bitbucket-pipelines.yml
file. Let’s take a closer look at how that’s done.
Getting ready
Before adding Docker commands to the bitbucket-pipelines.yml
file, we need to enable the following configurations:
- Allowing access to the Docker daemon
- Enabling Docker BuildKit
These configurations are part of bitbucket-pipelines.yml
. Let’s see where they go.
Enabling access to the Docker daemon
Access to the Docker daemon as a service can be done either by adding Docker as a service to an individual step, which is recommended so that you can keep track of how many services your overall pipeline is running, or by adding Docker as a service to all steps. Let’s see how each alternative is done...