Skip to content

How to build the project with Docker

Gary Rowe edited this page Jan 19, 2015 · 2 revisions

Building with Docker

Docker is an application that will automatically set up complex environments on your local machine using virtual machines. It will save you a lot of effort if you just want to try a project out and you don't know the underlying development environment.

Step 1 - Install Docker

Visit the Docker website, watch the brief tutorial and install it. If you encounter problems on OS X there is a great article to help you.

Step 2 - Test it with "Hello World"

Start the Docker installation and type docker run hello-world when prompted (after VM and Docker daemon have started). You should see output like this:

$ docker run hello-world
... some other stuff

Hello from Docker.
This message shows that your installation appears to be working correctly.

... more other stuff

That makes sure that Docker is working.

Step 3 - Install Git (and set up a GitHub account)

Git keeps track of all changes to text and binary files so that you can always go back to earlier versions. We use it to keep track of all code changes and to link those changes to Issues that our users report to us.

Now is a good time to register for GitHub account if you haven't already done so. Even if you're not a developer having a GitHub account will allow you to keep track of open source projects that you've contributed to (good for your CV/resume) and you may find Git itself useful for your own day to day work - it's extremely flexible.

Install Git and consider also using the GitHub application that provides a simple user interface to it. You may find that you don't need it (your IDE will handle talking to Git for you) but it's useful to know that GitHub provide dedicated functionality.

To verify that Git is installed and working, do the following at the command line:

git --version

You should get a report that looks a bit like this:

git version 1.8.5.2 (Apple Git-48)

Step 4 - Clone the project

Most open source projects in GitHub provide a README.md file that offers build instructions aimed at developers familiar with the underlying technologies. This section will take you through this process with more detail.

Clone the MultiBit HD repository with the following commands (still at the command line):

cd <where you want the code>
git clone https://github.com/bitcoin-solutions/multibit-hd
cd multibit-hd
git checkout develop

Git will provide a lot of information about what is being downloaded and the progress it is making. The repository can take a bit of time to arrive the first time, but subsequent updates are nearly instant. Many open source projects use the develop branch as their day-to-day working branch with master being for production releases.

This clone of the project repository is entirely under your control. You can make any changes you like to it. However, you won't have the ability to push those changes back upstream to our repository so don't worry about making breaking changes, you can always revert back to the latest known good position using

git reset --hard HEAD

The above command will wipe out all your local changes and take you back to the last update (pull) you made which should always be a good build.

Step 5 - Build and run the latest code in Docker

Each time you want to run the code from now on, type the following in the MultiBit HD project directory (where you cloned it):

git pull
docker build .

The git pull ensures you are running against the latest code. The first time you run the docker command Docker will download a lot of supporting code so be prepared for it to take some time. Subsequent changes are much faster.

If all goes well you should see the project build and run in its own Docker Container.