Bitbucket Server/Data Center - install and configure using Docker

Before installing, review the prerequisites and the general instructions for installation using Docker.

This integration is useful to ensure a secure connection with your on-premise Bitbucket deployment.

This page describes two distinct authentication schemes: Basic Auth and Bearer (Personal Access Token). Your Bitbucket Server settings might preclude Basic Auth usage, in which case Bearer Auth is preferred.

Configure Broker to be used with Bitbucket using Basic Auth

The following explains how to configure Snyk Broker to use the Broker Client with a Bitbucket Server deployment.

To use the Snyk Broker Client with BitBucket, run docker pull snyk/broker:bitbucket-server. Refer to BitBucket Server/Data Center - environment variables for Snyk Broker for definitions of the environment variables.

If necessary, go to the Advanced configuration page and make any configuration changes needed, such as providing the CA (Certificate Authority) to the Broker Client configuration if the Bitbucket instance is using a private certificate, and setting up proxy support.

Docker run command to set up a Broker Client for Bitbucket using Basic Auth

Copy the following command to set up a fully configured Broker Client to analyze Open Source, IaC, Container, Code files, and Snyk AppRisk information. Enable Snyk AppRisk to identify your application assets, monitor them, and prioritize the risks.

Multi-tenant settings for regions other than the default When you set up Snyk Broker for use in regions other than the default, additional environment variables with specific URLs are required. For the URLs and examples, see Regional hosting and data residency, Broker URLs.

docker run --restart=always \
           -p 8000:8000 \
           -e BROKER_TOKEN=<secret-broker-token> \
           -e BITBUCKET_USERNAME=<username> \
           -e BITBUCKET_PASSWORD=<password> \
           -e BITBUCKET=<your.bitbucket-server.domain.com (no http/s)> \
           -e BITBUCKET_API=<your.bitbucket-server.domain.com/rest/api/1.0 (no http/s)> \
           -e PORT=8000 \
           -e BROKER_CLIENT_URL=<http://broker.url.example:8000 (dns/IP:port)> \
           -e ACCEPT_IAC=tf,yaml,yml,json,tpl \
           -e ACCEPT_CODE=true \
           -e ACCEPT_APPRISK=true \
       snyk/broker:bitbucket-server

Snyk AppRisk is set by default to false. Enable it by setting the flag to true.

As an alternative to using the Docker run command, you can use a derived Docker image to set up the Broker Client integration. See Derived Docker images for the environment variables to override for the BitBucket Server/Data Center integration.

Configure Broker to be used with Bitbucket using a Personal Access Token (PAT)

The following explains how to configure Snyk Broker to use the Broker Client with a Bitbucket Server deployment using a Personal Access Token (PAT).

To use the Snyk Broker Client with BitBucket, run docker pull snyk/broker:bitbucket-server-bearer-auth. For definitions of the environment variables, refer to Bitbucket Server/Data Center - environment variables for Snyk Broker Basic Auth and Bitbucket Server/Data Center - environment variables for Snyk Broker Personal Access Token (PAT).

If necessary, go to the Advanced configuration page and make any configuration changes needed, such as providing the CA (Certificate Authority) to the Broker Client configuration if the Bitbucket instance is using a private certificate, and setting up proxy support.

Docker run command to set up a Broker Client for Bitbucket using a PAT

Copy the following command to set up a fully configured Broker Client to analyze Open Source, IaC, Container, Code files, and Snyk AppRisk information. Enable Snyk AppRisk to identify your application assets, monitor them, and prioritize the risks.

docker run --restart=always \
           -p 8000:8000 \
           -e BROKER_TOKEN=<secret-broker-token> \
           -e BITBUCKET_PAT=<personal-access-token> \
           -e BITBUCKET=<your.bitbucket-server.domain.com (no http/s)> \
           -e BITBUCKET_API=<your.bitbucket-server.domain.com/rest/api/1.0 (no http/s)> \
           -e PORT=8000 \
           -e BROKER_CLIENT_URL=<http://broker.url.example:8000 (dns/IP:port)> \
           -e ACCEPT_IAC=tf,yaml,yml,json,tpl \
           -e ACCEPT_CODE=true \
           -e ACCEPT_APPRISK=true \
       snyk/broker:bitbucket-server-bearer-auth

Snyk AppRisk is set by default to false. Enable it by setting the flag to true.

As an alternative to using the Docker run command, you can use a derived Docker image to set up the Broker Client integration. See Derived Docker images for the environment variables to override for the BitBucket Server/Data Center integration.

Start the Broker Client container and verify the connection with Bitbucket

Paste the Broker Client configuration to start the Broker Client container.

Once the container is up, the Bitbucket Integrations page shows the connection to Bitbucket and you can Add Projects

Basic troubleshooting for Broker with BitBucket

  • Run docker logs <container id> to look for any errors, where container id is the Bitbucket Broker container ID.

  • Ensure relevant ports are exposed to Bitbucket.

Last updated

More information

Snyk privacy policy

© 2024 Snyk Limited | All product and company names and logos are trademarks of their respective owners.