Install Bitbucket Using Docker Compose
By Vladimir Mikhalev · Solutions Architect · Docker Captain · IBM Champion
This article is for those looking for a detailed and straightforward guide on installing Bitbucket using Docker Compose.
Bitbucket is a Git-based source code repository hosting service owned by Atlassian. Bitbucket offers both commercial plans and free accounts with an unlimited number of private repositories.
TIPArchitecture Context
Choose self-hosted Bitbucket Data Center when your organization requires on-premises source control for compliance, air-gapped environments, or tight LDAP/AD integration. For most teams, Bitbucket Cloud eliminates server maintenance and provides native CI/CD via Pipelines. Self-hosting is justified when regulatory frameworks mandate that source code never leaves your network perimeter.
💾 You can find the repository used in this guide on GitHub.
NOTEWe’ll use Traefik as our reverse proxy. It’ll handle obtaining cryptographic certificates from Let’s Encrypt for your domain names and route requests to the corresponding services based on those domains.
CAUTIONTo obtain cryptographic certificates, you will need A-type records in the external DNS zone, which point to the IP address of your server where Traefik is installed. If you have created these records recently, you should wait before starting the installation of the services. Full replication of these records between DNS servers can take from a few minutes to 48 hours or even longer in rare cases.
IMPORTANTDocker Engine and Docker Compose must be installed on the server.
For a step-by-step guide on installing Docker Engine on Ubuntu Server, see Install Docker Engine and Docker Compose on Ubuntu Server
IMPORTANTOpenSSH must be installed on the server, and port 22 must be open in order to be able to connect to the server using the SSH protocol.
To install OpenSSH on the server you can use the command:
sudo apt install openssh-serverNOTETo connect to the server from a Windows system, you can use tools like PuTTY or MobaXterm.
NOTEThis guide walks you through connecting to a server with the iTerm2 terminal emulator on macOS.
CAUTIONYou will need to open the following TCP ports for access to the services:
- TCP port 80 - to obtain a free cryptographic certificate through the Let’s Encrypt certification center.
- TCP port 443 - to access the Bitbucket web interface.
- TCP port 7999 - for secure SSH Git operations, user SSH key management, encrypted data transfer, and server administration tasks.
We connect to the server on which Bitbucket is planned to be installed.
Now it is necessary to create networks for your services.
We create a network for Traefik using the command:
docker network create traefik-network
We create a network for Bitbucket using the command:
docker network create bitbucket-network
Next, you need to clone the repository that contains the configuration files, which include all the necessary conditions for Bitbucket to work.
You can clone the repository using the command:
git clone https://github.com/heyvaldemar/bitbucket-traefik-letsencrypt-docker-compose.git
Navigate to the directory with the repository using the command:
cd bitbucket-traefik-letsencrypt-docker-compose
Next, you need to change the variables in the .env file according to your requirements.
IMPORTANTThe
.envfile should be in the same directory asbitbucket-traefik-letsencrypt-docker-compose.yml.
Now let’s start Bitbucket with the command:
docker compose -f bitbucket-traefik-letsencrypt-docker-compose.yml -p bitbucket up -d
To access the Bitbucket management panel, go to https://bitbucket.heyvaldemar.net from your workstation, where bitbucket.heyvaldemar.net is the domain name of my service. Accordingly, you need to specify your domain name that points to the IP address of your server with the installed Traefik service, which will redirect the request to Bitbucket.
NOTEYou need to specify the domain name of the service, previously defined in the
.envfile.
You’ll now need to enter a license key for Bitbucket.
If you don’t have one, you can obtain a temporary key to test out Bitbucket.
Select “I need an evaluation license” and click “I have an account” or “Create an account” to proceed.

If you possess an Atlassian account, input the email address linked to that account in the “Enter email” field, then click the “Continue” button.
Enter the password for your Atlassian account and click the “Log in” button.

For the next step, indicate the product you need a temporary license key for and enter your organization’s name.
Click the “Generate License” button to secure a temporary license for Bitbucket.

Next, you’ll need to confirm the installation of the temporary Bitbucket license key on your server.
Click the “Yes” button to proceed.

In the “License Key” field, enter the temporary license key you received earlier and then click the “Next” button.

For the next step, please enter your username, name, email address, and password to set up a Bitbucket administrator account.
Click the “Next” button to continue.

Log in with the account created on the previous step.

Bitbucket is all set and ready to use.

To access the Traefik control panel, go to https://traefik.bitbucket.heyvaldemar.net from your workstation, where bitbucket.zabbix.heyvaldemar.net is the domain name of my service. Accordingly, you need to specify your domain name that points to the IP address of your server with the installed Traefik.
NOTEYou need to specify the domain name of the service, previously defined in the
.envfile.
Enter the username and password previously set in the .env file, and click the “OK” button.

Welcome to the Traefik control panel.

Related Posts
- 1Install ownCloud Using Docker ComposeSelf-Hosting · Learn how to install ownCloud with Docker Compose on Ubuntu using Traefik and Let's Encrypt. Secure, scalable file storage and sharing for your server.
- 2Install Docmost Using Docker ComposeSelf-Hosting · Learn how to install Docmost using Docker Compose with Traefik and Let's Encrypt. Step-by-step guide for self-hosting a modern documentation platform.
- 3Install AFFiNE Using Docker ComposeSelf-Hosting · Step-by-step guide to install AFFiNE using Docker Compose with Traefik and Let's Encrypt. Build your open-source productivity platform in minutes.
- 4Install Homebox Using Docker ComposeSelf-Hosting · Step-by-step guide to install Homebox with Docker Compose and Traefik. Secure your home inventory system with HTTPS using Let's Encrypt.
Random Posts
- 1Infosys Deploys Devin AI Globally — And Your DevOps Career Just Became Legacy LaborOpinion & Culture · Infosys just deployed Devin AI globally. If you are a DevOps engineer competing on technical execution, you are now "Legacy Labor". Here is the blueprint to survive.
- 2Amazon Q vs DevOps Chaos — Can This AI Fix AWS Faster Than You?DevOps & Cloud · Fix AWS issues faster with Amazon Q, the AI assistant built for DevOps. Real-world examples, limitations, and how it compares to ChatGPT.
- 3Update Kernel in UbuntuSysAdmin & IT Pro · Learn how to safely update the Linux kernel in Ubuntu using Terminal and .deb packages. Step-by-step guide for system administrators and Linux users.
- 4Essential Commands for Listing Docker ContainersDevOps & Cloud · Master Docker with essential commands for listing containers. This guide covers all you need to manage container states efficiently.