New Features in Docker 1.9, Including Virtual Networks and Persistent Storage

DZone 's Guide to

New Features in Docker 1.9, Including Virtual Networks and Persistent Storage

MVB Arun Gupta goes over the new features in Docker 1.9, including the ability to create virtual networks, persistent storage support, and Docker Swarm 1.0.0.

· DevOps Zone ·
Free Resource

Docker 1.9 is released, read Announcing Docker 1.9 for complete details. This release contains:

  • Docker 1.9.0 Client Binary
  • Docker Machine 0.5.0
  • Docker Compose 0.5.0
  • Docker Toolbox 1.9.0
  • Docker Swarm 1.0.0

Some of the key features are:

  • Create virtual networks that span multiple hosts and backed by multiple plugins such as Calico, Weave, Cisco, and others (full details).
  • Persistent storage support using new volume management system and backed Flocker or Ceph (full details).
  • Docker Swarm is 1.0.0 and ready for production, tested with 1000 nodes and 30,000 containers (complete list, Announcing Swarm 1.0).
  • Docker Machine code is split into core Docker Machine client and multiple binaries, one each for the driver (complete list).
  • Docker Compose now runs on Windows, environment variables are supported in docker-compose.yml file (complete list).

Getting Started With Docker

If you’ve never installed Docker on your machine, then Docker Toolbox 1.9.0 installs everything you need to get started with Docker on Mac OS X and Windows. It even includes Virtual Box 5.0.8.

Docker 1.9 Toolbox

Download Docker Toolbox 1.9.0 for Mac or Windows.

Of course, you can apt-get install docker-engine on Ubuntu or yum install docker-engineon CentOS.

If you like to update binaries independently or learn how to use them to get started, read ahead!

Install Docker 1.9.0 CLI Binary

Download the latest Docker CLI binary:

> curl -L https://get.docker.com/builds/Darwin/x86_64/docker-1.9.0 > /usr/local/bin/docker
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9010k  100 9010k    0     0   211k      0  0:00:42  0:00:42 --:--:--  213k
> docker -v
Docker version 1.9.0, build 76d6bc9

Install Docker Machine 0.5.0

Docker Machine allows you to create Docker Engines on your laptop, on cloud, or inside your data center.

Docker Machine Logo

Download the latest Docker Machine binary:

~ > curl -L https://github.com/docker/machine/releases/download/v0.5.0/docker-machine_darwin-amd64.zip >machine.zip && \
>   unzip machine.zip && \
>   rm machine.zip && \
>   mv -f docker-machine* /usr/local/bin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   608    0   608    0     0    777      0 --:--:-- --:--:-- --:--:--   778
100 38.9M  100 38.9M    0     0   208k      0  0:03:11  0:03:11 --:--:--  118k
Archive:  machine.zip
  inflating: docker-machine          
  inflating: docker-machine-driver-amazonec2  
  inflating: docker-machine-driver-azure  
  inflating: docker-machine-driver-digitalocean  
  inflating: docker-machine-driver-exoscale  
  inflating: docker-machine-driver-generic  
  inflating: docker-machine-driver-google  
  inflating: docker-machine-driver-hyperv  
  inflating: docker-machine-driver-none  
  inflating: docker-machine-driver-openstack  
  inflating: docker-machine-driver-rackspace  
  inflating: docker-machine-driver-softlayer  
  inflating: docker-machine-driver-virtualbox  
  inflating: docker-machine-driver-vmwarefusion  
  inflating: docker-machine-driver-vmwarevcloudair  
  inflating: docker-machine-driver-vmwarevsphere

Docker Machine has been split into multiple binaries – one for the core Docker Machine client and a binary for each driver. So the installation is different from the previous releases.

And create a new machine as:

~ > docker-machine create -d=virtualbox lab
Running pre-create checks...
Creating machine...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Provisioning created instance...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
To see how to connect Docker to this machine, run: docker-machine env lab

A new machine created using this could not be queried by Docker CLI (#2147). Upgrading the machine explicitly using docker-machine upgrade lab helped resolve the issue.

> docker-machine upgrade lab
Stopping machine to do the upgrade...
Upgrading machine lab...
Latest release for github.com/boot2docker/boot2docker is v1.9.0

Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.9.0/boot2docker.iso to /Users/arungupta/.docker/machine/cache/boot2docker.iso...
Starting machine back up...

Hopefully this is just a timing issue and will not occur going forward.

Docker Compose 0.5.0

Docker Compose allows to easily run multi-container applications.

> curl -L https://github.com/docker/compose/releases/download/1.5.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   601    0   601    0     0    190      0 --:--:--  0:00:03 --:--:--   190
100 4819k  100 4819k    0     0   123k      0  0:00:39  0:00:39 --:--:--  238k
> chmod +x /usr/local/bin/docker-compose
> docker-compose -v
docker-compose version: 1.5.0

A simple way to verify is to run three node Couchbase Cluster:

couchbase-cluster > docker-compose up -d
Pulling couchbase1 (couchbase/server:latest)...
latest: Pulling from couchbase/server
c0de77b824d9: Pull complete
7f183271ade4: Pull complete
02cc7e934fcc: Pull complete
fd97fd3cdea7: Pull complete
c55759c6a761: Pull complete
2520930519cb: Pull complete
6597f338e656: Pull complete
7b49522b71f2: Pull complete
7789bd549668: Pull complete
63ff6eb12d29: Pull complete
1095332e719c: Pull complete
a64bcb125f74: Pull complete
13fe802e8814: Pull complete
d5c923126f19: Pull complete
39d4343f1a05: Pull complete
13d820fd06ce: Pull complete
Digest: sha256:0e983929897ae9bd396533ff7875f30027290c6acf164a66c967ca8884507381
Status: Downloaded newer image for couchbase/server:latest
Creating couchbasecluster_couchbase1_1
Creating couchbasecluster_couchbase3_1
Creating couchbasecluster_couchbase2_1

And the list of running containers:

couchbase-cluster > docker-compose ps
                 Name                                   Command                                   State                                    Ports                  
couchbasecluster_couchbase1_1            /entrypoint.sh couchbase-s ...           Up                                       11207/tcp, 11210/tcp, 11211/tcp,       
                                                                                                                           18091/tcp, 18092/tcp, 8091/tcp,        
                                                                                                                           8092/tcp, 8093/tcp                     
couchbasecluster_couchbase2_1            /entrypoint.sh couchbase-s ...           Up                                       11207/tcp, 11210/tcp, 11211/tcp,       
                                                                                                                           18091/tcp, 18092/tcp, 8091/tcp,        
                                                                                                                           8092/tcp, 8093/tcp                     
couchbasecluster_couchbase3_1            /entrypoint.sh couchbase-s ...           Up                                       11207/tcp,>11210/tcp,   
                                                                                                                           11211/tcp, 18091/tcp, 18092/tcp,       

A later blog will show how to use persistent storage volumes to store the data.

Currently, Docker Compose requires docker-compose.yml from the local filesystem. It would be useful for docker-compose to use these files from a URI (#2313).

Docker Swarm 1.0.0

Docker Swarm provides native clustering for Docker. It converts a pool of Docker Engines into a single virtual engine. The tools, such as Docker CLI, that work with a single engine continues to work Swarm. So your applications that would run on a single Docker Engine can now easily run on multiple Docker Engines.

Docker Swarm Logo

> docker pull swarm
Using default tag: latest
latest: Pulling from library/swarm
2bc79aec8ea0: Pull complete 
dc2fb86a875a: Pull complete 
435e648d0f23: Pull complete 
e16042a92d05: Pull complete 
045bd7b00b5b: Pull complete 
3caea1253d76: Pull complete 
2b4c55187a27: Pull complete 
6b40fe7724bd: Pull complete 
Digest: sha256:1ab748e67f00ee34d0bedcb306caede47c02dad3e0e03455d558448cadb079bc
Status: Downloaded newer image for swarm:latest

Read more in Clustering using Docker Swarm for more details on how to setup cluster.

Download or upgrade your binaries to Docker 1.9, and use the latest features!

Docker Hands-on Workshop and Slides

Docker hands-on workshop will be updated to use Docker 1.9 in the coming days, stay tuned!

Latest slides to introduce Docker are available at github.com/javaee-samples/docker-java/tree/master/slides.

docker, news

Published at DZone with permission of Arun Gupta , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}