Have you ever wanted to run Jira, Confluence or other Atlassian products in a jiffy so that you can test something without affecting your existing environments? This blog will give you the kickstart you need to get going. You should be ready to execute a few terminal commands and have a little sense of adventure to continue.
Get Docker Installed
Instead of directly installing the Atlassian applications on your computer like any other application, we'll use an easy method of installing new standalone instances of the application which you can re-use, clear out, and re-instantiate at any time. There are a few technologies which help with these requirements like using virtual machines or containers. We're going to proceed with containers using Docker.
This isn't a blog that is going to deep dive into all aspects of Docker. I'm going to give you some basics to get going, so if you want to go further you'll need to do a little study yourself. You can start finding out more about Docker and the differences between containers and virtual machines by checking out their description at: What is a Container?
Now, get Docker installed and we'll be on our way. You can find the instructions and download for Docker Community Edition (CE) for Mac, Windows or Linux (should be in the left side navigation) located at the following URL About Docker CE. For most operating systems, you'll need to set up a Dockerhub account in order to download.
Oh cpt my cpt
Once you have Docker installed, you can get started on running Atlassian applications in containers. Docker gives you the ability to create your own containers, but since we're in a hurry, we're going to skip the hassle and find ready-made containers created by trustworthy people. One such person is Martin Aksel Jensen (a.k.a. cptactionhank). You can find his Atlassian/Docker contributions to the world at both Github and Dockerhub:
The same material is available through either resource including a wide range of Atlassian applications. For now, we'll proceed with Dockerhub and choosing Jira Software at JIRA ❤ Docker which gives the basic quick startup that we're covering and a number of different options you can use to run it. Those options are worth reviewing as they allow you to specify different versions of Jira to use, etc.
Let's get it started with his "I'm in the fast lane!" instructions:
# I'm in the fast lane! docker run --detach --publish 8080:8080 cptactionhank/atlassian-jira-software:latest
Here's an example of what dumps out after you execute the statement showing progress bars for download, etc.
Unable to find image 'cptactionhank/atlassian-jira-software:latest' locally latest: Pulling from cptactionhank/atlassian-jira-software bdf0201b3a05: Pull complete 9e12771959ad: Pull complete c4efe34cda6e: Pull complete 1d4239783f3c: Pull complete 77a01666efe7: Pull complete Digest: sha256:cea368d5f0f60be464f842fae8e8b76d5a4fc24d2f6112ef05103e4d4215f42a Status: Downloaded newer image for cptactionhank/atlassian-jira-software:latest e8ac122daa3c6c02adf773fbbb5162e558e2667a0f190e95e0aa9989c80d34c0
At the very end, it prints out a full hash representing the running container. The hash will be similar to what is listed here:
Now, go to your browser and you should see the startup screen for Jira: http://localhost:8080
To proceed with full startup of Jira Software, you'll need a license key. If you haven't already set up a MyAtlassian account, you'll be able to proceed with that by selecting the "Set it up for me" option, otherwise proceed with "I'll set it up myself".
Some Basic Docker Commands
Though this isn't a deep dive, I can't send you into the wild without at least a few commands so that you can tail logs, restart and clean up after yourself.
docker ps command to show you the running containers you have.
# show docker processes docker ps
To operate on your containers, the following Docker commands take as a parameter either the container ID or the name (we'll use container ID). You only need to use a portion of the container ID that uniquely identifies it -- usually the first 3 characters is fine (e.g.
e8a to represent
Because I go absolutely nuts if I don't follow the log of a running application, let's set it up. Open up another terminal window so you can keep it running while you execute other commands. You can hit key combination control-c at any time to quit following.
# tail the application log docker logs -f e8a
In order to stop, start or perform all-in-one restart, simply execute the corresponding commands:
# stop docker stop e8a # start docker start e8a # restart docker restart e8a
At this point you may ask yourself, "Okay, but what if I stop my container and come back to work on it later -- how will I remember my container ID?" Just execute the following command to see a list of all your containers both started and stopped.
# show me all my container IDs docker container ls -a
Cleaning up after yourself
Keep in mind, every time you use the
docker run command a new container is created. So -- you can have any number of Jira Software containers kept on your system each with their own set of data. This can be useful as long as you track which data is in which container. Eventually you'll want to clean up old containers, the data they contain (volumes), and possibly the images (think Docker template) they're based on.
# this will clean up the basics -- stopped containers, unused networks, unused images docker system prune # this will also include removing volumes of all the containers being removed docker system prune --volumes # this will also remove the images which will force them to re-download -- a quick and dirty way to force pulling the images tagged 'latest' # however you'll want to be frugal deleting images the more you use Docker docker system prune --volumes --all
Hopefully that'll give you a good quick start with both Docker and running Atlassian applications on your own computer and give you a taste of what's possible. There are ways to expand on this including running a database in a Docker instance for your Jira instance to connect to. To look into wrapping this up in an easier format, check out Docker Compose. But if you really would like to dig in further, check out this blog by Michael March who got me started on Docker: Jira Server + Oracle + Docker in 15 Minutes