It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10.

I prefer to use Jira in a docker container because:

1. I can install Jira with a couple of commands.

2. I can start and stop Jira just by starting and stopping containers.

3. I can easily delete any Jira, which I do not need.

4. I do not make my folder structure "messy" with all kinds of jira folders.

5. I can see all Jira instances, that I am currently running, with a single command.

If to sum up all the above, docker containers make my life easier to control all available Jira instances on my pc.

If you search in google for Jira docker, then you will find the following page:

https://hub.docker.com/r/cptactionhank/atlassian-jira/

This image is not supported by Atlassian, that is why use it wisely and kindly read the Contributions part of the main page for the docker image. I use this image in my notebook for research. If you want to use it not for research, kindly test the image first.

The command, which will let you run this container, is defined like this:

docker run --detach --publish 8080:8080 cptactionhank/atlassian-jira:latest

The problem with the Jira container is:

1. Jira does not have internet access, that is why you will not be able to install plugins from the Jira UI.

2. You can not access Jira Home folder, where the logs, indexes, plugin configurations are. For example, if you have the ScriptRunner plugin, then you will not be able to work with the script folder, which is placed in the Jira Home folder.

You will be able to see the Jira logs though, if you attach to the docker container by the docker attach command.

That is why I prefer to run Jira in a docker container the following way:

1. Create a volume where all files from the Jira Home folder will be stored.

docker volume create jirahome

you can see, where the created volume is in your file system, with the following command:

docker volume inspect jirahome

 The output will be like this:

 

Selection_025.png

2. Run Jira docker container.

docker run --detach --net host --mount source=jira78,destination=/var/atlassian/jira --publish 8080:8080 cptactionhank/atlassian-jira:latest

After that you can launch your Jira in localhost:8080. Your Jira will have internet access and you can see all files of the Jira Home folder in your local filesystem.

26 comments

Great - I love this Article.

Andy Heinzer Atlassian Team Mar 19, 2018

I would recommend against using that specific docker image of Jira.   Mostly because it's using openjdk, a java platform that Jira Server does not support.   I'm not completely opposed to using docker, I just think it might be unwise to advise users to follow this guide when they don't understand the installation decisions made by the image creator.

@Andy Heinzer Thank you Andrew. I added the following part to the article:

This image is not supported by Atlassian, that is why use it wisely and kindly read the Contributions part of the main page for the docker image. I use this image in my notebook for research. If you want to use it not for research, kindly test the image first.

This is awesome @Alexey Matveev [cPrime]

Thanks a lot!

Hello @Andy Heinzer,

That's why I created an image with Oracle JDK :) and legal license.

You can find it there : https://hub.docker.com/r/frogbis/jira-software/

You can enjoy it :)

Regards,

Franck

You might also have a look at the atlassian docker builder which allows you to build docker images for any atlassian application.

It is open source and available here

We created a blog to show how it is being used
https://www.idalko.com/atlassian-jira-upgrade-journey-using-docker-and-the-atlassian-docker-builder/

 

We are using it extensively to deploy jira, confluence, bamboo, ... 

It helps us a lot whenever testing for instance Exalate.  This issue synchronisation addon is requiring a lot of Jira's  and without the docker approach we would never be able to test it properly (in an automated way)

 

Hope this helps

 

Francis

Great stuff! We are also using docker images for quick testing.


It is worth mentioning that Atlassian have official account with available docker images of some products like Confluence: Official Confluence Server image

The thing I don't understand about the various Jira containers I've seen is how they persist the data. I know that at the least we need to persist the Jira home and database, but none of the examples I've looked at seem to do that. ???

I wish the atlassian-docker-builder was still maintained in a way that would let me post issues.. I'm having .. issues with it, and no really good place to ask for feedback to solve them, so I'm currently building the official images myself.

There are two forks of it, but none seem to include any changes/improvements so far.

@scott8035

The Jira container uses docker volumes to persist data. The cptaction image uses two volumes, one for the confluence home directory and another for the <confluence installation>/logs directory. As for the database, that is not inside the container; it has to be set up separately. If you don't specify a volume name in the run command, the image will automatically create anonymous (unnamed) volumes. It makes updates a lot easier if you create a volume ahead of time and mount it to the container using the --volume or --mount option in the run command as described in this article.

You can learn more about volumes here:

https://docs.docker.com/storage/volumes/

Good job! We actually have been running Jira in container for quite a while. And it works perfectly fine. Just a fews more things that I want to share:

1) Performance wise it is better have a volume for log as well, it is located at <jira_install_path>/logs.

2) Enable JMX, as it is in container. so 127.0.0.1 does not work, you have to use the host IP.

Hi all.

Do you install Jira DC in containers? Must i use docker network or host-based network ( host ip address)?

Can i configure ehcache replication using docker (isolate) network?

You should have a look at the image provided by codeclou
https://github.com/codeclou/docker-atlassian-jira-data-center

 

It works wonderfully well - and fully documented.

Hi, thank you for you answer.

But at the image provided by codeclou he deploy all instances on one host with bridge network and all works good.

In my situation (production env) different conteiners with jira instances locates on different hosts. And i cant configure docker nettwork ehcahe replication between all conteiners.

With bitbucket and hazelcast (HAZELCAST_NETWORK_TCPIP_MEMBERS) we manual configure ip addresses and all works good.

Ah - yes. 
It is for development and testing purposes. 

Hi, thank you for answer.

Does Atlassian have a solution for production environment using DC with containers?
How copy cache through nodes in docker network?

Hello.

We connected docker with Jira DC - use in your compose "network_mode: host" and all features work well (but without network isolation).

We have a solution for running Jira, Confluence and Bitbucket in either server or Data center mode in Kubernetes, deployed via Helm charts. We call it ASK (Atlassian Software in Kubernetes)

Read more here :

https://www.praqma.com/services/ask/

Let me know if you have questions. Im one of the lead developers on ASK.

Hi 

@Михаил Малиновкин

 

I am trying to set up Jira/Confluence DC in docker environment.

 

As you said in earlier comment you configured in multiple hosts.

 

1.Did you user docker swarm with overlay network.

2.Did you use only compose file.

 

Will be helpful if you can bit elaborate on the setup?

for me, jira in a container is such a pain.

I've spent a couple of days already trying to make it work.

the last issue I see is jira cannot use an existing mysql database, but when you start a container it's a new jira installation(?)

so, I have a QNAP that has a container station.

I have mysql in a container and I want to install jira in a container that supposed to use the mysql database.

1. jira doesn't support default mysql collation utf8_ci.

well I worked that around by manually set collation to jira DB after I manually created it

then instantiate jira container and it finally stops complaining about collation

2.  the most important: jira cannot use an existing mysql database.

that means - if I stop container at QNAP and start it again - it cannot start with all the exceptions:

        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)                                                                                                                                                                                                                                                                          at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)                                                                                                                                                                                                                                                                                     at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)                                                                                                                                                                                                                                                                       at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)                                                                                                                                                                                                                                                               at java.sql.DriverManager.getConnection(DriverManager.java:664)                                                                                                                                                                                                                                                                             at java.sql.DriverManager.getConnection(DriverManager.java:247)                                                                                                                                                                                                                                                                             at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.getTestDatabaseConnection(DefaultAtlassianBootstrapManager.java:347)                                                                                                                                                                                                     at com.atlassian.jira.config.database.JdbcDatasource.getConnection(JdbcDatasource.java:211)                                                                                                                                                                                                                                                 at com.atlassian.jira.config.database.DatabaseConfig.testConnection(DatabaseConfig.java:89)                                                                                                                                                                                                                                                 at com.atlassian.jira.health.checks.DbConfigurationAndConnectionCheck.onDatabaseConfigured(DbConfigurationAndConnectionCheck.java:53)                                                                                                                                                                                                       at com.atlassian.jira.health.HealthCheckTemplate.perform(HealthCheckTemplate.java:29)                                                                                                                                                                                                                                                       at com.atlassian.jira.health.DefaultHealthCheckExecutor.runCheck(DefaultHealthCheckExecutor.java:71)                                                                                                                                                                                                                                        at com.atlassian.jira.health.DefaultHealthCheckExecutor.lambda$applyAndCollectExceptions$0(DefaultHealthCheckExecutor.java:51)                                                                                                                                                                                                              at java.lang.Iterable.forEach(Iterable.java:75)                                                                                                                                                                                                                                                                                             at com.atlassian.jira.health.DefaultHealthCheckExecutor.applyAndCollectExceptions(DefaultHealthCheckExecutor.java:51)                                                                                                                                                                                                                       at com.atlassian.jira.health.DefaultHealthCheckExecutor.performHealthChecks(DefaultHealthCheckExecutor.java:42)                                                                                                                                                                                                                             at com.atlassian.jira.health.HealthChecks.executeChecksAndRecordResults(HealthChecks.java:164)                                                                                                                                                                                                                                              at com.atlassian.jira.health.HealthChecks.runHealthChecks(HealthChecks.java:154)                                                                                                                                                                                                                                                            at com.atlassian.jira.health.HealthChecks.runHealthChecks(HealthChecks.java:66)                                                                                                                                                                                                                                                             at com.atlassian.jira.startup.BootstrapContainerLauncher.start(BootstrapContainerLauncher.java:44)                                                                                                                                                                                                                                          at com.atlassian.jira.startup.DefaultJiraLauncher.preDbLaunch(DefaultJiraLauncher.java:118)                                                                                                                                                                                                                                                 at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:104)                                                                                                                                                                                                                                              at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)                                                                                                                                                                                                                                                        at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:103)                                                                                                                                                                                                                                                       at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:157)                                                                                                                                                                                                                                       at java.lang.Thread.run(Thread.java:748)                            

 

however, if I remove the DB file  - it can successfully connect the mysql database and ask me to init new one.

should I re-create/re-install all the jira every time I restart container????????

 

I wonder how this tool is sold out to so many companies with such a basic use-case failure?

why it cannot re-use an existing database?

 

thanks,

Roman

Is docker swarm suitable for datacenter instances?.As swarm manager uses ingress load balancing i dont think sticky sessions will be retained

Docker swarm does not keep container identity when new containers are replacing crashed ones. So, that's why swarm is not suitable for data center. 

 

We just open sourced ask, our solution on data center in kubernetes. 

Thanks.Also will swarm support stick session as it uses ingress load balancing.How kubernetes is managing it.

Ingress controllers used with kubernetes supports sticky sessions. The only one I know that doesn't is contour. 

We have migrated our dev set up to docker with host network and is working perfectly.Though network isolation is not there.

Comment

Log in or Sign up to comment
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

315 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you