Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
When you use a self-hosted runner, you may want to pull the Atlassian public Docker images from your own registry or use modified versions of our public Docker images.
To use Docker images from a custom Docker registry in your self-hosted runner, you can configure them using: PAUSE_IMAGE, AUTH_PROXY_IMAGE, and CLONE_IMAGE.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
docker container run -it -v /tmp:/tmp \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/docker/containers:/var/lib/docker/containers:ro \
-e ACCOUNT_UUID=<my-account-id> \
-e REPOSITORY_UUID=<my-repository-id> \
-e RUNNER_UUID=<my-runner-id> \
-e OAUTH_CLIENT_ID=<my-oauthclient-id> \
-e OAUTH_CLIENT_SECRET=<my-oauthclient-secret> \
-e WORKING_DIRECTORY=/tmp \
-e RUNTIME_PREREQUISITES_ENABLED=true \
-e PAUSE_IMAGE="my-private-registry/my-pause:latest" \
-e AUTH_PROXY_IMAGE="my-private-registry/my-auth-proxy:latest" \
-e CLONE_IMAGE="my-private-registry/my-clone:latest" \
--name my-runner-b0ae87b8-423b-5c24-9a95-84ddad9cdfae \
docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1
The default Atlassian Docker images used by the self-hosted runners are:
PAUSE_IMAGE – docker-hub.packages.atlassian.com/google/pause:latest
AUTH_PROXY_IMAGE – docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-auth-proxy:prod-stable
CLONE_IMAGE – docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-dvcs-tools:prod-stable
All of the above default images can be retrieved using docker pull without logging in (they are public images).
If your server is behind a firewall, don’t forget to allowlist the domains you’d like to pull images from.
The Docker-based runner can be configured to pull versions of the public Atlassian docker images from a private docker registry that allows authentication using a username and password.
To use a private Docker image hosted on a Docker registry (such as Docker Hub), create or update the .docker/config.json file with login credentials for the Docker registry. The use of authentication credentials other than basic authentication (a username with a password), such as tokens and timed passwords is not supported. The use of a credential store is also not supported.
A .docker/config.json file can be created either by:
To create or update the ~/.docker/config.json file with login credentials:
On the runner host, run the following command and provide your username and password when prompted:
1
docker login <registry_hostname>
If the login is successful, you will receive a warning about unencrypted storage of your password and the message Login Succeeded.
If you don't receive the warning, the docker instance on the host may be configured to use a credential store, which is not supported.
Mount the host .docker/config.json file in the runner container using the volume flag (-v), such as:
1
-v <path_to_docker_config_directory>/.docker:/root/.docker
Where the default location for <path_to_docker_config_directory>/.docker is ~/.docker/.
For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
docker container run \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/docker/containers:/var/lib/docker/containers:ro \
-v <path_to_docker_config_directory>/.docker/config.json:/root/.docker/config.json \
-e ACCOUNT_UUID=<my-account-id> \
-e REPOSITORY_UUID=<my-repository-id> \
-e RUNNER_UUID=<my-runner-id> \
-e OAUTH_CLIENT_ID=<my-oauthclient-id> \
-e OAUTH_CLIENT_SECRET=<my-oauthclient-secret> \
-e WORKING_DIRECTORY=/tmp \
-e RUNTIME_PREREQUISITES_ENABLED=true \
-e PAUSE_IMAGE="my-private-registry/my-pause:latest" \
-e AUTH_PROXY_IMAGE="my-private-registry/my-auth-proxy:latest" \
-e CLONE_IMAGE="my-private-registry/my-clone:latest" \
--name my-runner-b0ae87b8-423b-5c24-9a95-84ddad9cdfae \
docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1
To manually create or update the ~/.docker/config.json file with login credentials:
On the runner host, use a plain text editor to create or open the .docker/config.json file in the user's home directory.
Add or append the auths top-level property, such as:
1
2
3
4
5
6
7
8
9
10
{
"auths": {
"my-private-registry-uri": {
"auth": "dXNlcjpwYXNzd29yZA=="
},
"my-other-private-registry-uri": {
"auth": "dXNlcjE6cGFzc3dvcmQx"
}
}
}
Where my-private-registry-uri and my-other-private-registry-uri are the URLs of two private registries, such as Docker Hub. The auth values are the username and password for registries (colon-separated) after they have been base64 encoded. To base64 encode the username and password on a macOS or Linux command line, run:
1
echo -n 'user:password' | base64
Mount the host .docker/config.json file in the runner container using the volume flag (-v), such as:
1
-v <path_to_docker_config_directory>/.docker:/root/.docker
Where the default location for <path_to_docker_config_directory>/.docker is ~/.docker/.
For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
docker container run \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/docker/containers:/var/lib/docker/containers:ro \
-v <path_to_docker_config_directory>/.docker/config.json:/root/.docker/config.json \
-e ACCOUNT_UUID=<my-account-id> \
-e REPOSITORY_UUID=<my-repository-id> \
-e RUNNER_UUID=<my-runner-id> \
-e OAUTH_CLIENT_ID=<my-oauthclient-id> \
-e OAUTH_CLIENT_SECRET=<my-oauthclient-secret> \
-e WORKING_DIRECTORY=/tmp \
-e RUNTIME_PREREQUISITES_ENABLED=true \
-e PAUSE_IMAGE="my-private-registry/my-pause:latest" \
-e AUTH_PROXY_IMAGE="my-private-registry/my-auth-proxy:latest" \
-e CLONE_IMAGE="my-private-registry/my-clone:latest" \
--name my-runner-b0ae87b8-423b-5c24-9a95-84ddad9cdfae \
docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1
This feature has the following limitations:
Authentication using a credential store is not supported. Only login using basic authentication (username and password) is supported.
The images must be hosted in a registry. The runner will always pull images from a remote host and can't use images on the host device.
This feature is only available to Docker self-hosted runners. Other runners (such as shell-based runners) don't use containers.
Was this helpful?