The Quickest Way to Get Started with Docker

12171166215_4ec135c6b2_o

Containers are not only those things are used for shipping stuff around – or storing the things you will never use or you don’t want to spoil – they are also used (and if you ask me – might even replace virtual machines in the not to distant future) as a platform to run applications / services / stacks.

Docker is one that is getting a large amount of focus lately

Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere.

Docker containers can encapsulate any payload, and will run consistently on and between virtually any server. The same container that a developer builds and tests on a laptop will run at scale, in production*, on VMs, bare-metal servers, OpenStack clusters, public instances, or combinations of the above.

Common use cases for Docker include:

  • Automating the packaging and deployment of applications
  • Creation of lightweight, private PAAS environments
  • Automated testing and continuous integration/deployment
  • Deploying and scaling web apps, databases and backend services

(Source – Docker)

A quick introduction presentation to docker is embedded below

Docker introduction from Docker

I wanted to share with you a quick and easy way to start looking at docker and what you can do with it. And the most basic part of it is installing and configuring docker.

If you are just looking to play with it – you could install a VM with Ubuntu or and go through the motions of installation on your platform of choice.

But I would like to get you up and running as fast as can be.

Enter boot2docker

Boot2docker demo

boot2docker is a lightweight Linux distribution based on Tiny Core Linux made specifically to run Docker containers. It runs completely from RAM, weighs ~24MB and boots in ~5s.

And to make it even easier Mitchell Hashimoto (the author of Vagrant) has created a vagrant box so you start it up in even less time.

I can understand why this is going to take off – and why containers will have a good use case for a number of reasons and applications.

It is unbelievably fast!!

It takes less than a second – microseconds even, to start a container (i.e. a VM/OS/instance)

Just to emphasize how fast – let me show you a small example

I have a base ubuntu image and I ran a simple test:

  1. list running images
  2. ping the container (to show it is not up
  3. start the container
  4. ping the container again.
#!/bin/sh

docker ps  
ping 172.17.0.2 -c 2  
docker run -d phusion/baseimage  
ping 172.17.0.2 -c 2  
exit  

At the same time I followed the docker log.

2014/05/27 14:02:27 GET /v1.10/containers/json  
2014/05/27 14:02:38 POST /v1.10/containers/create  
2014/05/27 14:02:38 POST /v1.10/containers/17029e...c45f1d1f92f899/start  
[libcontainer] 2014/05/27 14:02:38 created sync pipe parent fd 14 child fd 13  
[libcontainer] 2014/05/27 14:02:38 attach terminal to command  
[libcontainer] 2014/05/27 14:02:38 starting command  
[libcontainer] 2014/05/27 14:02:38 writting pid 1947 to file  
[libcontainer] 2014/05/27 14:02:38 setting cgroups  
[libcontainer] 2014/05/27 14:02:38 setting up network  
[libcontainer] 2014/05/27 14:02:38 closing sync pipe with child  

14:02:27 – I queried to see there were no containers running.
Ping timed out over the next 11 seconds
14:02:38 - Container was created and was available within 1 second

How do you like them apples?

Are you ready to try out docker?

And of course this is a simple demonstration – you can get much more creative than this!