Docker and StriderCD - Brilliant Continuous Integration in a Box

09 Aug 2013

Updated on 2014-01-18

Docker - the Linux container engine

Docker is the Linux container engine. It gives developers the ability to "pack, ship and run any application as a lightweight container". Docker containers can include applications along with all necessary dependencies. It also manages startup, port mapping/networking and resource allocation. Furthermore Docker tracks changes on a copy-on-write filesystem (AUFS) to enable a change graph - similar conceptually to a VCS like Git - so containers may be built from other containers and only the differences need to be stored.

StriderCD consists of a Node.JS application server and so it requires Node be installed. It also uses MongoDB, so it needs a MongoDB database for persistence.

Dockerized StriderCD

We can create a Docker container from the Ubuntu base image and then install a recent version of Node.JS, along with Strider itself and MongoDB process. We can then distribute this container as an image over the internet via the Docker Index.

The very talented Strider contributor Jared Forsyth [github] implemented precisely this in his awesome Strider Dockerfile on Github.

Once this has completed successfully, you should see the Strider image in your Docker images list:

Running StriderCD in a Box

Now that you have the Strider Docker image available, you can run it. The Strider Docker image exposes the following ports from inside the container: 3000 (Strider itself), 22 (SSHD) and 27071 (MongoDB).

By default, Docker will randomly select ports on the Docker host to map to those internal ports. However, you can supply them on the command line. So, to have port 3000 on our host map to port 3000 in the Strider container, we can run:

$ docker run -d -p 3000:3000 niallo/strider

Or if we wished to also map SSHd and MongoDB to ports 44 and 27017 respectively:

$ docker run -d -p 3000:3000 -p 27000:27017 -p 44:22 niallo/strider

Now if you run docker ps you should see your Strider container running:

Strider is now accessible from your Docker host on port 3000. Assuming you are running Docker on localhost, if you browse to http://localhost:3000/ you should see the homepage for your personal Strider-in-a-box!

Vagrant Usage

NOTE: If you are running Docker in Vagrant (as many OS X users do) you will need to make sure Strider's port 3000 inside the VM is mapped to your host. Read about Vagrant port mappings here.

You can now log in. The default admin user for the Dockerized Strider is:

email: test@example.com
password: dontlook

Security note
Of course, it isn't wise to leave the default password in place - you should delete this user from MongoDB as soon as you create a new admin user with a secure password. The query to do so is:

db.users.remove({email:"test@example.com"})

Run this against the strider-foss database.

Production Usage and More Help

We hope you have found Strider's Dockerfile a super easy way to get a continuous integration server up and running on your own local machine.

For a real production, internet-accessible Strider deployment, you'll need to do a little more work. You'll have to create your own Github Application for domains other than localhost and you might want to use a more reliable external MongoDB cloud host such as MongoLab. You'll also want to configure an SMTP server for test success/failure notification emails (we use Mailgun).

If you need help installing, hosting or customizing Strider, we provide commercial support and services (custom continuous integration plugins, branded test dashboards, etc). Shoot us an email at hi@frozenridge.co or use the contact form on our website at frozenridge.co.