Running Atlassian server product on Docker

Atlassian server products can be installed using a Docker image as well as an installer running directly on your OS.
Official docker image for Jira is published in Atlassian repository in Docker hub, so I will introduce some tips to use Atlassian server products using Docker.

Objectives

The objectives of this article are

  • Starting up Jira, Confluence and Bitbucket on your client machine using Docker

  • Installing each single product

  • Setting up integrations between products

Note, I keep configuration as simple as possible, therefore it's not suitable for production environment. For example, some requirements like data persistence or SSL is not supported on the configuration in this article.
Also, I won't consider connecting via SSH to Bitbucket because it's not necessary for the objective of this article.

 

Prerequisite

Install Docker on your machine. It may be better allocating enough memory for Docker when you boot multiple containers. I confirmed steps in this article with the following environment.

  • Docker Desktop 2.1.0.3 on macOS Mojave (7 GB memory allocated for Docker)

  • Jira 8.4.0

  • Confluence 7.0.1

  • Bitbucket 6.6.1

Installing and setting up each product

Jira Software

1. Open terminal and hit following command


docker run -d -p 8080:8080 atlassian/jira-software:latest

2. Open following URL with your browser
http://localhost:8080

Confluence

1. Open terminal and hit following command

docker run -d -p 8090:8090 atlassian/confluence-server:latest

2. Open following URL with your browser
http://localhost:8090

Bitbucket

1. Open terminal and hit following command

docker run -d -p 7990:7990 atlassian/bitbucket-server:latest

2. Open following URL with your browser
http://localhost:7990

 

You've done! Services run inside container by docker run command, and start listening on each port, so you can go to setup page.
In this step, proceed to evaluation setup choosing embedded database.

 

Setting up integration of products

Above step is quite simple if you want to try using single product, but it's not sufficient if you wanted to try integrations of each products.
Because each container that is running services doesn't belong to same network and can't communicate each other.
There would be several ways to let each container communicate. Here, I'll introduce a way to boot multiple containers in a same network utilizing docker-compose.

 

Requirement

You can try using integration functionalities by fulfilling following requirements at least.

  • Each service in containers can communicate each other

  • Name of each service is resolved by a unique URL

Note about second one. Most of Atlassian product have a configuration named "Base URL" as a unique service URL. Although you can configure multiple URLs for your instances as described in How to create an unproxied application link , it would be more straightforward if you configured as your browser and each product access using unique URLs for each services.
I will show you an example that each service is accessed via following URLs

See following diagram to figure out a network configuration.

docker-compose-sample-en.png

 

Steps

1. First, your client computer has to allow you to access to itself looping back your requests via the above URL.
Easiest way to achieve this is just to add records in your hosts file.

127.0.0.1 jira.internal
127.0.0.1 confluence.internal
127.0.0.1 bitbucket.internal

Otherwise, you can configure local DNS using dnsmasq and letting your client computer to resolve above name as 127.0.0.1.

2. Create following two files and put them on any new directory.

docker-compose.yaml

version: '3' 
services:
jira:
container_name: jira
image: atlassian/jira-software:latest
environment:
- ATL_PROXY_NAME=jira.internal
- ATL_PROXY_PORT=80
- ATL_TOMCAT_SCHEME=http

confluence:
container_name: confluence
image: atlassian/confluence-server:latest
environment:
- ATL_PROXY_NAME=confluence.internal
- ATL_PROXY_PORT=80
- ATL_TOMCAT_SCHEME=http

bitbucket:
container_name: bitbucket
image: atlassian/bitbucket-server:latest
environment:
- SERVER_PROXY_NAME=bitbucket.internal
- SERVER_PROXY_PORT=80
- SERVER_SCHEME=http

nginx:
container_name: nginx
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- jira
- confluence
- bitbucket
ports:
- "80:80"
networks:
default:
aliases:
- jira.internal
- confluence.internal
- bitbucket.internal

nginx.conf

events {} 
http {
server {
server_name jira.internal;
proxy_read_timeout 600s;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://jira:8080;
client_max_body_size 10M;
}
}
server {
server_name confluence.internal;
proxy_read_timeout 600s;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://confluence:8090;
client_max_body_size 10M;
}
}
server {
server_name bitbucket.internal;
proxy_read_timeout 600s;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://bitbucket:7990;
client_max_body_size 10M;
}
}
}

 

3. Now you are ready! Run following command and boot containers.

docker-compose up -d

 

4. Open "Application Link" page in Jira

https://confluence.atlassian.com/adminjiraserver/using-applinks-to-link-to-other-applications-938846918.html

Create application link for Confluence and Bitbucket.

Now you can use functionalities like Jira Issue Macro or Smart Commit

 

Troubleshooting

Each Docker container consumes about 2GB so some container may not boot properly if memory is not allocated enough.

You can configure memory allocation setting as https://docs.docker.com/config/containers/resource_constraints/

 

Note

In this article I introduced steps to install Atlassian product with simple configuration and this won't be suitable for production environment. But you will be able to configure to work on your production environment. Please refer to the following documentations for detailed specification.

 

 

34 comments

rene_robinson March 17, 2020

This article needs a bit more on how to access these in my network.

I'm not running on localhost but in a private network like most users. What URL would I use? what about finishing the setup? Connecting to the database?

This article is not finished...

rene_robinson March 17, 2020

Follow up...

OK, I got thrown by the 127.0.0.1 settings in Hosts.

What this should say is to define the entries in the hosts file as

<serverIP> jira.internal

THEN it's fully correct. My server within my home network is at 192.168.1.2, so all the Docker apps would be accessible from 192.168.1.2. Only use 127.0.0.1 if you are installing this on a machine with a graphical system and you are actually logged in on, such as your laptop.

As far as finishing up, all the apps operate as normal, requesting setup if required. What I don't know is what happens if I re-run the docker-compose with my existing database, i.e. an upgrade...

 

Have to take a look at how that all unfolds. If I'm lucky, if will see the file that shows the settings and recognize the DB...

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 22, 2020

Hi @rene_robinson, great to hear that you utilize my article to run on your environment. 

You are right, use 127.0.0.1 only when you want to run on your client machine for the evaluation. And tweaking hosts file would be the most handy way to resolve the name jira.internal  to point 192.168.1.2. Otherwise setting up a DNS server would be suitable option for larger network. 

As for

What I don't know is what happens if I re-run the docker-compose with my existing database, i.e. an upgrade...

You can use Docker volume for data persistence. It will keep your database even when you recreated containers. 

Hope this helps :)

ReneRobinson March 23, 2020

Nobuyuki, Thanks for the follow up. I did set up a volume and will have to test the persistence. 

One more thing, you may need to increase the 10M on Nginx to 100M if you want to post anything larger than 10M, like photos, etc. Found out when trying to add pictures to confluence. 

Thanks for the help. 

Jorge Jerez March 24, 2020

Hi

 

First of all thanks for this post, It's being really useful to me. 

I'm getting an error with the gadgets URL. 

I've added to my host:

127.0.0.1 jiralocal.com

 Then, in docker compose file jira container: 

jira:
image: atlassian/jira-software
networks:      
- jiranet
ports:      
- "8080:8080"
environment:
- "ATL_PROXY_NAME=jiralocal.com"
       - "ATL_PROXY_PORT=80"
       - "ATL_TOMCAT_SCHEME=http"
       - "ATL_TOMCAT_CONTEXTPATH=/jira"

 And Nginx container on Docker compose:

nginx:
image: nginx:latest
volumes:      
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- jira
ports:
80:80
networks:
- jiranet

And then I have the nginx.conf file like this:

events {}
http {
server {
server_name jiralocal.com;
proxy_read_timeout 600s;
location /jira {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://jira:8080/jira;
client_max_body_size 10M;
}
}
}

 

I can access jira on http://jiralocal.com/jira without any extrange problem, but gadgets return 

gadget.common.error.500 and URL base is set to the URL I use to access. 

In the logs the error is:

2020-03-24 13:53:17,080+0000 HealthCheck:thread-4 ERROR [c.a.t.j.healthcheck.support.GadgetFeedUrlHealthCheck] An error occurred when performing the Gadget feed URL healthcheck
org.apache.http.conn.HttpHostConnectException: Connect to jiralocal.com:80 [jiralocal.com/127.0.0.1] failed: Connection refused (Connection refused)

I'm running this on W10

Can anyone help me with this? 

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 26, 2020

Hi @Jorge Jerez , thank you for your comment! 

It seems you encountered Jira activity stream gadget throws gadget.common.error.500 . Jira has to be able to access to itself by base url.

In your case, apparently the request to jiralocal.com is looping back to Jira container itself as it is resolved as 127.0.0.1. You will have to configure your network to let  jiralocal.com be resolved as the nginx container because 80 port is exposed only on the nginx.

I think adding an alias to jiralocal.com in the nginx container will do the trick.   

  nginx: 
....
networks:
default:
aliases:
- jiralocal.com

 Hope this helps. 

Jorge Jerez March 26, 2020

Hi @Nobuyuki Mukai

Thanks for your comment, yesterday I tested that way and worked for me, I'm new on Docker so I have a lot of thing to learn. 

 

Anyway, some people with experience in Docker ask me to use Traefic instead of Nginx or Apache, because work better on Docker, do you know something about this?

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 26, 2020

Hi, @Jorge Jerez , Great to hear that worked in your environment :)

And as for traefik, yes, I believe it can be an alternative to Nginx. I've used traefik before for testing purpose, and it was working fine as far as I tested. Also I found someone who configures traefik with Atlassian products --

Tobi_P April 7, 2020

@Nobuyuki Mukai As I understood application links are using O-Auth authentification to establish the link. Even though: is there a possibility to preconfigure application links in the docker-compose file (maybe by providing credentials for a admin user account, which should be created on startup)?

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 7, 2020

hi @Tobi_P , unfortunately, the Atlassian's docker images don't support the configuration to the application link. 

Though this is unofficial and I cannot guarantee that it will work, the workaround in https://jira.atlassian.com/browse/JRASERVER-61753 may help the automation of the application link creation process. Please vote if this feature request interests you. 

andybandy89 June 26, 2020

Hi @Nobuyuki Mukai 

Thanks for this great article. I had this idea for a long time and then with the help of your article finally implemented it. Our DEV and TEST environments for Jira and Confluence are running on Docker now since almost a half year. We have done some further configuration and described it here:

http://coffeetime.solutions/run-atlassian-jira-and-confluence-with-postgresql-on-docker/

Thank you very much! 

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2020

Hi @andybandy89 

Thanks for your comment! I'm happy to hear that my article helped you :)

aarti rajput June 30, 2020

Thanks @Nobuyuki Mukai

This is really helpful while setting up jira ,confluence on a same platform.

However i was facing issue while running docker-compose up -d

Error:

Status: Downloaded newer image for nginx:latest

Creating jira ... done

Creating confluence ... done

Creating bitbucket ... done

Creating nginx ... error


ERROR: for nginx Cannot create container for service nginx: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled","StackTrace":" at Docker.ApiServices.Mounting.FileSharing.<DoShareAsync>d__6.MoveNext() in C:\\workspaces\\stable-2.3.x\\src\\github.com\\docker\\pinata\\win\\src\\Docker.ApiServices\\Mounting\\FileSharing.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n

P.S. I have updated the c and d drive as well in file sharing. please suggest.

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 8, 2020

Hi @aarti rajput 

It sounds like you are facing https://stackoverflow.com/questions/60754297/docker-compose-failed-to-build-filesharing-has-been-cancelled . Did you restart Docker for Windows after updating the file sharing section?

aarti rajput July 9, 2020

Thanks for Reply @Nobuyuki Mukai .

But File sharing is already enabled and docker is restarted also. its working if i commented volumed section in docker-compose.yml.

with mounted volume its not working

nginx: container_name:

nginx image: nginx:latest

volumes:

- ./nginx.conf:/etc/nginx/nginx.conf

depends_on: - jira

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 9, 2020

@aarti rajput 

It sounds like a problem of Docker for Windows or Windows OS itself. Do you use the latest version of the Docker? 

Otherwise you may be able to avoid the usage of mounted volume for nginx by tweaking the compose file a bit.

For example, change the nginx section of docker-compose.yaml to build from docker file

nginx:
container_name: nginx
build:
context: .
dockerfile: nginxdockerfile
ports:
- "80:80"
....

and locate a file nginxdockerfile in a same directory.

FROM nginx:latest
COPY ./nginx.conf /etc/nginx/nginx.conf

That will create a nginx container which already includes nginx.conf without using mounted volume.  

Alexander Meier August 6, 2020

Hi @Nobuyuki Mukai and thanks for this article!

It worked great on my notebook for a local first test. But now I wanted to run the same on a different little server and I'm having problems to get it configured properly.

The problem is that on that small server we already have a native webserver running that handles requests for ports 80, 8080 as well as 443 and some more (and in addition we also have a few docker / docker-compose apps running which use local port forwarding but on unrelated ports)

The problem I'm having now is that whilst the containers themselves seem to come up, I can't really access them through the browser with nginx as reverse-proxy. The only one that seems to be working correctly is Jira, which I can access through the browser.

Since the small server is reachable on our internal network at 'ourlittleserver.ournetwork.private' I changed the Env vars as follows for the 3 containers

[ATL|SERVER]_PROXY_NAME=ourlittleserver.ournetwork.private
...
[ATL|SERVER]_PROXY_PORT=8095
...
# and in the nginx service spec:
ports:
- "8095:80"

 

I assume that I have to set some more Env-Vars for my specific setup and maybe also change some more port settings. 

But it feels a bit like searching for the needle in the hay stack.. any help to speed up my process is greatly appreciated ;-)

Thanks!

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 25, 2020

Hi @Alexander Meier thanks for commenting on the article!

If your nginx server listens only for "ourlittleserver.ournetwork.private", all the browser request will be passed to single destination in the backend.

In my sample, nginx is sorting out the request using name based virtual hosting.

nginx.conf has multiple servers

http {
server {
server_name jira.internal;
...
server {
server_name confluence.internal;

 and docker containers are waiting for these request with the environment variable 

    environment:
- ATL_PROXY_NAME=jira.internal
.....
environment:
- ATL_PROXY_NAME=confluence.internal

I hope this helps. 

Tom Stieger September 22, 2020

FYI- your link the the docker resource constraints looks to have a couple extra characters at the end (%C2%A0).

This link works though: https://docs.docker.com/config/containers/resource_constraints/

Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 22, 2020

Hi @Tom Stieger 

Thanks for pointing out my mistake. I fixed the link :) 

marc September 8, 2021

Hello,

what about https://hub.docker.com/u/atlassian ? It seems empty.

How can we fix the security issues with confluence running in docker?

Thanks and kind regards!

Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 22, 2021

This article is still relevant & helpful, particularly the docker-compose configuration. Thanks, Atlassian!

One small note, if you're like me and want to install plugins larger than 10 MB into the resulting container, you may need to tweak the nginx.conf file a bit.

 client_max_body_size 100M;

If you're getting cryptic errors in UPM when installing the add-on and seeing HTTP 413 errors under the hood, this tip is for you!

I imagine this is relevant to other upload needs, like uploading large attachments to Jira, Confluence, and Bitbucket.

Like Nobuyuki Mukai likes this
Greengoatsoftware April 26, 2022

First of all nice guide, but have noticed a little typo you may want to correct on the next page update.

Near the top where you describe how to quickly get containers up and running for each Jira, Confluence and Bitbucket instances, in the Bitbucket section you have the commands correct for the docker container but below it where you list the URL to go to you have listed Confluence's port number (8090) instead of Bitbucket's (7990). 

Like I say its only a very tiny typo but it could trip up new users or those not used to having different containers on the same machine and accessing each one just with a change to the port number. :-) 

Like Nobuyuki Mukai likes this
Nobuyuki Mukai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 27, 2022

Hi @Greengoatsoftware thanks for pointing out the error. I fixed the typo to point to the right URL :)

Like Greengoatsoftware likes this
Jean-Philippe M January 31, 2023

@Nobuyuki Mukai Thank you for the article.

Can you clarify a comment you made "unfortunately, Atlassian's docker images don't support the configuration to the application link".

Is it still the case with the current version?

Does it mean that I cannot link JIRA with Bitbucket and Bamboo? I am preparing a training environment for doing CI with Atlassian products.

Thank you

Have a nice day

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events