This image provides a Bitbucket Server with an embedded database which is sufficient for demo and evaluation purpose. However, for production it is advised to use one of the supported external databases (e.g. PostgreSQL).
The following instructions show how to build and run Bitbucket Server.
docker-machine create --driver virtualbox atlassian (1)
docker-machine start atlassian (2)
eval `docker-machine env atlassian` (3)
-
Create a docker machine (once only)
-
Start the docker machine
-
Setup the docker client to use the docker-machine
docker build --build-arg vcs_ref=$(git rev-parse --short HEAD) -t softwarecraftsmen/atlassian-bitbucket-base .
hooks/build
is a script that performs a custom build providing build metadata for Docker image labels according to http://label-schema.org/.
The Bitbucket container uses tini as init system.
The tini
executable is expected at /dev/tini
.
As of Docker 1.13 tini is included in Docker itself.
But it is not enabled by default, see https://docs.docker.com/engine/reference/commandline/dockerd.
{
"init" : true
}
Further each container instance must be created using the --init
option.
docker pull softwarecraftsmen/atlassian-bitbucket-base
docker run -d --init --name bitbucket-server -p 7990:7990 softwarecraftsmen/atlassian-bitbucket-base
To open Bitbucket Server start page on Mac OSX run `open http://$(docker-machine ip atlassian):7990`from the shell:
During the first start of the container a few environment variables are considered for providing default values for the setup wizard. These allow for a fully automated setup without setup wizard intervention.
The subset of supported properties is as follows.
bitbucket.properties
variables
Environment | `bitbucket.properties | Default |
---|---|---|
|
|
|
|
|
Required for fully setting up an administrator account |
|
|
Required for fully setting up an administrator account |
|
|
Required for fully setting up an administrator account |
|
|
Required for fully setting up an administrator account |
|
|
Required for setting up an external database |
|
|
Required for setting up an external database |
|
|
Required for setting up an external database |
|
|
Required for setting up an external database |
|
|
|
|
|
Variable | Default value | Comment |
---|---|---|
SERVER_PROXY_NAME |
- |
- |
SERVER_PROXY_PORT |
- |
- |
SERVER_SCHEME |
http |
- |
SERVER_SECURE |
false |
- |
The container will respect the http_proxy
https_proxy
and no_proxy
variables and expose those as variable JVM_SUPPORT_RECOMMENDED_ARGS
according to https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html.
For replacing the internal embedded database we just have to set 2 environment variables for the JDBC driver and URL. Below is an example for PostgreSQL.
export BITBUCKET_JDBC_DRIVER=org.postgresql.Driver
export BITBUCKET_JDBC_URL=jdbc:postgresql://postgresdb:5432/bitbucket
For adding more custom properties we just can add a ${BITBUCKET_HOME}/bitbucket.properties
file to the image.
It will be moved to $BITBUCKET_HOME/shared/bitbucket.properties
during the initial startup.
The extending image can add this file in its Dockerfile
like
COPY bitbucket.properties ${BITBUCKET_HOME}/shared/bitbucket.properties
This base image offers a few environment variables especially for setting sensitive settings such as password or license keys that should not be committed to the repository.
They are automatically written into their respective property keys in bitbucket.properties
.
These are better set through environment variables and passed to the container rather than hard coded into bitbucket.properties
.