Docker 1.10, Machine 0.6.0, Compose 1.6.0 – better volumes and networking
Docker 1.10 is now released!
Read about all the new features in Docker 1.10. A quick summary:
- New Compose file format
- Much better networking
- Much better security
- Swarm becomes 1.1, with Mesos integration
Read Docker 1.10 release notes.
Lets look at some of the key components.
Docker Machine 0.6.0
Docker Machine makes it really easy to create Docker hosts on your computer, on cloud providers and inside your own data center. It creates servers, installs Docker on them, then configures the Docker client to talk to them.
Latest version can be installed as:
~> curl -L https://github.com/docker/machine/releases/download/v0.6.0/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine && \ ~> chmod +x /usr/local/bin/docker-machine % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 601 0 601 0 0 362 0 --:--:-- 0:00:01 --:--:-- 362 100 36.6M 100 36.6M 0 0 2822k 0 0:00:13 0:00:13 --:--:-- 4899k ~ > docker-machine version docker-machine version 0.6.0, build e27fb87
docker-machine now shows the Docker server version:
~ > docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS couchbase - virtualbox Running tcp://192.168.99.100:2376 v1.9.1 netbeans - virtualbox Saved Unknown
The latest server version is 1.10. And so docker upgrade
command can be used to fix that:
~ > docker-machine upgrade couchbase Waiting for SSH to be available... Detecting the provisioner... Upgrading docker... Stopping machine to do the upgrade... Upgrading machine "couchbase"... Default Boot2Docker ISO is out-of-date, downloading the latest release... Latest release for github.com/boot2docker/boot2docker is v1.10.0 Downloading /Users/arungupta/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v1.10.0/boot2docker.iso... 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100% Copying /Users/arungupta/.docker/machine/cache/boot2docker.iso to /Users/arungupta/.docker/machine/machines/couchbase/boot2docker.iso... Starting machine back up... (couchbase) Check network to re-create if needed... (couchbase) Waiting for an IP... Restarting docker...
The updated list of Machines is now shown as:
~ > docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS couchbase - virtualbox Running tcp://192.168.99.100:2376 v1.10.0 netbeans - virtualbox Saved Unknown
Notice that Docker version is now 1.10
.
Set up the environment variables such that Docker client can talk to it:
eval $(docker-machine env couchbase)
Docker Client 1.10
Lets download the latest client to connect to this Docker Engine.
> curl https://get.docker.com/builds/Darwin/x86_64/docker-latest > /usr/local/bin/docker % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10.0M 100 10.0M 0 0 3836k 0 0:00:02 0:00:02 --:--:-- 3836k > docker version Client: Version: 1.10.0 API version: 1.22 Go version: go1.5.3 Git commit: 590d5108 Built: Thu Feb 4 19:55:25 2016 OS/Arch: darwin/amd64 Server: Version: 1.10.0 API version: 1.22 Go version: go1.5.3 Git commit: 590d5108 Built: Thu Feb 4 19:55:25 2016 OS/Arch: linux/amd64
Client and Server versions are shown separately.
Run Couchbase container as:
~ > docker run -d -p 8091-8093:8091-8093 -p 11210:11210 arungupta/couchbase-node 4783d72298d1f27255f12cf765ed1121c7656d09a866bc350354e38787627a79
This starts up a fully-configured Couchbase server. It can be accessed at 192.168.99.100:8091 and looks like as shown:
Note, 192.168.99.100 is obtained using docker-machine ip <MACHINE-NAME>
.
Couchbase Developer Portal provide more details about the Couchbase Server.
Docker Compose 1.6.0
Docker Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running. Learn more about Docker Compose 1.6.0. Install the latest version:
curl -L https://github.com/docker/compose/releases/download/1.6.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 1067 0 --:--:-- --:--:-- --:--:-- 1065 100 4837k 100 4837k 0 0 945k 0 0:00:05 0:00:05 --:--:-- 1426k chmod +x /usr/local/bin/docker-compose
The experimental flags --x-networking
and --x-network-driver
, introduced in Compose 1.5, have been removed. Its no longer experimental and is the recommended way to enable communication between containers.
Compose 1.6.0 requires Docker Engine 1.9.1 or later, or 1.10.0 if you’re using version 2 of the Compose File format.
Updating Compose File
Compose 1.6 introduces a new version of the Compose file. Read more details about Upgrading Compose File.
Compose 1.6 will continue to run older version of Compose files. But now networking and volumes are first class citizens.
Here is an example of version 1 of Compose file:
mycouchbase: image: arungupta/couchbase-node ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210
Here is a version 2 of Compose file:
version: "2" services: mycouchbase: image: arungupta/couchbase ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210
For simple use cases, the two main changes are:
- Add a
version: '2'
line at the top of the file. - Indent the whole file by one level and put a
services:
key at the top.
Running services in this Compose file is:
~ > docker-compose up -d Creating network "couchbase_default" with the default driver Pulling mycouchbase (arungupta/couchbase:latest)... latest: Pulling from arungupta/couchbase a50d2b3f7efa: Already exists 27e1b0c788a2: Already exists 622b8fa00f81: Already exists a3ed95caeb02: Pull complete 0bc56fd185bd: Already exists 10f0979b6cbd: Already exists 9be3d8460ed2: Already exists 59e718ec07e9: Already exists a0b9aa29408d: Already exists e2717fa0b388: Pull complete Digest: sha256:9131c5a283d79e11b6556c94b0b0f8ceba7daf5ba5982bac850100099019959f Status: Downloaded newer image for arungupta/couchbase:latest Creating couchbase_mycouchbase_1
- This starts a fully configured Couchbase server based upon the image as explained at github.com/arun-gupta/docker-images/tree/master/couchbase-node.
Docker Swarm 1.1
Docker Swarm is native clustering for Docker. It allows you to create and access a pool of Docker hosts using the full suite of Docker tools. Because Docker Swarm serves the standard Docker API, any tool that already communicates with a Docker daemon can use Swarm to transparently scale to multiple hosts.
A new experimental support for container rescheduling on node failure is added.
Read more details about setting up Docker Swarm Cluster.
Finally, here are some useful links:
- Docker Toolbox 1.10
- Docker 1.10 Release Notes
- Docker 1.10 Security Improvements
- Docker for Java Developers
Enjoy!
Reference: | Docker 1.10, Machine 0.6.0, Compose 1.6.0 – better volumes and networking from our JCG partner Arun Gupta at the Miles to go 2.0 … blog. |