Menu

You can’t use Windows to play with Docker. You have to use something else. While you may think it a good idea to use something akin to Boot2Docker that does a lot of the work for you, I think it’s worth while seeing the whole process for yourself. After all, it’s not THAT hard. IF you want to use Boot2Docker, I’m not going to complain! Even though you are running commands on Windows, the major docker work is done inside of the Linux host.

Installing Linux

To start, install Ubuntu 14.04 LTS Desktop on a virtual machine. I’ve got a beefy enough machine to handle Hyper-V alongside other applications. My VM has four virtual processors, 1GB of RAM, plenty of disk and dynamic RAM turned on. I’m using the amd64 build so I have 64-bit support on Ubuntu. The process is fairly straight forward – just boot the VM from the ISO and follow the instructions. If you are trying this out on Azure, AWS or another cloud provider, then just use one of their pre-built VMs. You can expect the process to take around 20 minutes.

Once you have logged in as the user you created, it’s a good idea to update the machine. Close the pop-up Keyboard Shortcuts and click on the top left “Canonical Logo” icon – this brings up a search window. You want to start a Terminal.

Once that is started, type:

sudo apt-get update

The sudo command is equivalent to “run-as Administrator” in Windows land, so it’s not lightly done. However, many things in Docker require root privileges. In this case, I am updating the sources – consider it “check for updates”. To actually do the update, type the following:

sudo apt-get upgrade

This will download (after asking permission) and install the updates to the operating system. Linux is very much more granular than Windows in its updating. It’s not uncommon to have hundreds of updates. Just like any operating system, updating to the latest should be the first thing you do. Say goodbye to another 15 minutes plus of waiting for the updates to finish.

The default desktop experience has a password protected screen saver. Also, you will likely need to reboot at the end of the process. Log back in once it’s done. Unlike Windows, you don’t have to re-check for updates after a successful install. All the updates are installed at once. Yes, I wish Windows did this too.

Installing Docker

Now that I have a stable and updated Linux release, let’s install Docker. There are some good instructions on the Docker web site and you can find some good walk-throughs on the web. I’m going to walk through all the bits here.

wget -qO- https://get.docker.com/ | sh

The process will prompt you for your password – this is to install as root (it’s actually a sudo command underneath). Once it is complete, it will give you an interesting nugget:

Your username is contained in $USER, so you can just type:

sudo usermod -aG docker $USER

Log out by using the gear-type icon in the top right hand corner and selecting Log Out… Then log in again. I also need to do other things – the instructions walk you through them – setting up memory accounting controls, fixing the firewall, and setting up DNS. Rather than repeat the reasons and process behind it, I’m just going to do it. Just type sudo bash in your terminal window and follow the instructions. Don’t worry about restarting things. Once you get to the bottom of the page, just reboot the server.

Starting a simple containerized service

Everyone uses the hello-world service to test that it’s working. Let’s do something more challenging than that. Let’s install a service we might actually want to use. I’m going to install a container for Archeologit – a data visualization tool for GitHub. First of all, I’m going to clone my Github repository:

Pro Tip: You’ll find yourself continually starting Terminal. When it’s running, right-click on the icon in the left hand dock and select Lock to Launcher. Then you can just click on the Icon. The thing on the left hand side is just like the taskbar.

This run command will pull down the image from the Docker Hub Repository, create an image based on it and then start running it. Once it’s downloaded, you can just run it. Once you see that it is serving on HTTP:8000, use the local Firefox browser to browse to http://localhost:8001.

You will be able to access the docker container from your PC as well. While the container is running, bring up a new terminal and type ifconfig eth0 – this will give you the IP address of your local Ubuntu image. You can now browse to http://:8001/ and see the same display.

This docker image will be removed once you press Ctrl-C in the running terminal window. But now you have a functional Docker implementation that actually does something useful and you can start learning about containers.