Personal

Migrating from Boot2Docker to Docker ToolBox

Docker ToolBox

Docker-ToolBox is a new way to install Docker on Mac OSX, Linux and Windows. It deprecated the old way of installing docker with ‘Boot2Docker‘. In this post, we will see how to migrate from Boot2Docker to Docker ToolBox. It will be great start if you are new to Docker. This post become popular since, it’s been tweeted by @Docker.

Installation

It’s fairly easy to install Docker-ToolBox on Mac OSX. Visit this page and download it for Mac OSX. Once you download it. You can follow installation steps

Detailed documentation is here . Docker toolbox consist of following toolkit.

  • Docker Client – New Docker binary
  • Docker-Machine – Replacement of Boot2Docker
  • Docker-Compose – Managing multiple container with config
  • Docker KiteMatic – Graphical User Interface for the Docker Containers.
  • VirtualBox – Brand New VirtualBox

Once, installation finished you can click on ‘Docker-Quick-Start‘ application.

This will configure your settings. Basically this will execute ‘start.sh’  script inside ‘Docker-Quick-Start’ application. You can also launch this by

docker_quick-start

At this stage, you can see the ‘default’ machine has been started in the VirtualBox.

default-VM

Now, you should have ‘docker-machine’ command available to use instead of Boot2Docker.

There will be all available commands to use with ‘docker-machine’. It’s slightly different than Boo2Docker. Se what’s changed over here 

Now, we have configure machine environment

We may also need to configure our shell to use Docker. So run

Good idea will be to add this to your .bashrc or .zshrc profile.

Remove Boot2Docker from Mac OSX

Run these commands in order to get rid of Boot2Docker completely.

 

Hello World Docker

In order to check that your installation is complete and successful, run docker ‘hello-world’ application.

docker-hello-world

if you see something like above, your installation is successful and we can use docker commands as we are using previously with Boo2Docker.

You can also check environments of the configure machines

docker-machine-env

At this stage, you should able to use docker as you were using before with Boot2Docker.

Docker Compose

Docker compose is another tool to manage multiple containers. Docker compose was previously called as ‘fig’. You can install it with ‘pip’ . make sure you have python installed. You can run

This will install docker-compose. Now you will see all available commands available with docker-compose.

docker-compose

You can create docker-compose.yml file to configure your environment. This allows us to manage different containers. You can then use

I have configured Ruby-Cucumber tests with Docker. You can find source code on Github ‘docker-compose-cucumber‘.

Whenever we use ‘docker-compose up’ that will execute my cucumber tests inside the container. You can see that, docker compose is doing it’s job

docker-compose

Note: Remember it’s still in beta so Docker docs didn’t recommend to use in production yet.  

KiteMatic

Kitematic is graphical user interface to manage you containers. You can see how many containers are currently running. Kitematic is installed as part of docker toolbox. You can launch kitematic by cliking on the Kitematic icon in the OSX Application.

In the ‘docker-compose’ section, we have seen that we ran cucumber tests inside the container. In order to see the container logs we can use ‘Kitematic’. This will show container logs as shown below

kitematic

Kitematic has following feature

  1. Graphical user interface to start, stop containers
  2. Container logs
  3. Docker Hub Integration
  4. CLI Integration to execute commands inside docker containers.
  5. Settings for each containers e.g IP, Port, EVN Variables,

You can also add remove settings from UI.

kitematic settings

Now you can use latest Docker-Toolbox to in your development environment. I will keep this article upto date as per latest changes in the Docker.

have fun !!

Video Demo