Docker 1.6 released – Docker Machine 0.2.0
Docker 1.6 was released yesterday. The key highlights are:
- Container and Image Labels allow to attach user-defined metadata to containers and images (blog post)
- Docker Windows Client (blog post)
- Logging Drivers allow you to send container logs to other systems such as Syslog or a third-party. This available as a new option to
docker run
,--log-driver
, which has three options:json-file
(the default, and same as the old functionality),syslog
, andnone
. (pull request) - Content Addressable Image Identifiers simplifies applying patches and updates (docs)
- Custom cgroups using
--cgroup-parent
allow to define custom resources for those cgroups and put containers under a common parent group (pull request) - Configurable ulimit settings for all containers using
--default-ulimit
(pull request) - Apply Dockerfile instructions when committing or changing can be done using
commit --change
andimport –change`. It allows to specify standard changes to be applied to the new image (docs)
- Changelog
In addition, Registry 2.0, Machine 0.2, Swarm 0.2, and Compose 1.2 are also released.
This blog will show how to get started with Docker Machine 0.2.0. Subsequent blogs will show how to use Docker Swarm 0.2.0 and Compose 1.2.
Download Docker Client
Docker Machine takes you from zero-to-Docker on a host with a single command. This host could be your laptop, in the cloud, or in your data center. It creates servers, installs Docker on them, then configures the Docker client to talk to them.
It works with different drivers such as Amazon, VMWare, and Rackspace. The easiest to start on a local laptop is to use VirtualBox driver. More details on configuring Docker Machine in the next section. But in order for Docker commands to work without having to use SSH into the VirtualBox image, we need to install Docker CLI.
Lets do that!
1 2 | Aruns-iMac:~ arungupta$ curl https: //get .docker.com /builds/Darwin/x86_64/docker-latest > /usr/local/bin/docker chmod +x /usr/local/bin/docker |
If you have installed Boot2Docker separately, then there is Docker CLI included in the VM. But this approach would allow you to directly call multiple hosts from your local machine.
Docker Machine 0.2.0
Learn more details about Docker Machine and how to getting started with version 0.1.0. Docker 1.6 released Docker Machine 0.2.0. This section will talk about how to use that and configure it on Mac OS X.
- Download Docker Machine 0.2.0:123456
Aruns-iMac:~ arungupta$ curl -L https:
//github
.com
/docker/machine/releases/download/v0
.2.0
/docker-machine_darwin-amd64
>
/usr/local/bin/docker-machine
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 401 0 401 0 0 667 0 --:--:-- --:--:-- --:--:-- 668
100 11.3M 100 11.3M 0 0 1942k 0 0:00:05 0:00:05 --:--:-- 2686k
Aruns-iMac:~ arungupta$
chmod
+x
/usr/local/bin/docker-machine
- Verify the version:12
Aruns-iMac:~ arungupta$ docker-machine -
v
docker-machine version 0.2.0 (8b9eaf2)
- Download and install the latest VirtualBox.
- Create a Docker host using VirtualBox provider:010203040506070809101112
Aruns-iMac:~ arungupta$ docker-machine create --driver virtualbox mydocker
INFO[0000] Creating CA:
/Users/arungupta/
.docker
/machine/certs/ca
.pem
INFO[0001] Creating client certificate:
/Users/arungupta/
.docker
/machine/certs/cert
.pem
INFO[0003] Creating SSH key...
INFO[0003] Image cache does not exist, creating it at
/Users/arungupta/
.docker
/machine/cache
...
INFO[0003] No default boot2docker iso found locally, downloading the latest release...
INFO[0003] Downloading latest boot2docker release to
/Users/arungupta/
.docker
/machine/cache/boot2docker
.iso...
INFO[0014] Creating VirtualBox VM...
INFO[0019] Starting VirtualBox VM...
INFO[0019] Waiting
for
VM to start...
INFO[0062]
"mydocker"
has been created and is now the active machine.
INFO[0062] To point your Docker client at it, run this
in
your shell:
eval
"$(docker-machine env mydocker)"
- Setup client by giving the following command in terminal:1
Aruns-iMac:~ arungupta$
eval
$(docker-machine
env
mydocker)
- List the Docker Machine instances running:123
Aruns-iMac:~ arungupta$ docker-machine
ls
NAME ACTIVE DRIVER STATE URL SWARM
mydocker * virtualbox Running tcp:
//192
.168.99.100:2376
- List Docker images and containers:12345
Aruns-iMac:~ arungupta$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Aruns-iMac:~ arungupta$ docker
ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Aruns-iMac:~ arungupta$
Note, there are no existing images or container.
- Run a trivial Java EE 7 application on WildFly using arungupta/javaee7-hol image:010203040506070809101112131415161718
Aruns-iMac:~ arungupta$ docker run -it -p 8080:8080 arungupta
/javaee7-hol
Unable to
find
image
'arungupta/javaee7-hol:latest'
locally
Pulling repository arungupta
/javaee7-hol
a068decaf892: Download complete
511136ea3c5a: Download complete
5b12ef8fd570: Download complete
ae0c2d0bdc10: Download complete
e490dfcb3685: Download complete
f212cb9dbcf5: Download complete
28b11e6151f0: Download complete
. . .
23:54:25,481 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017534: Registered web context:
/movieplex7
23:54:25,513 INFO [org.jboss.as.server] (ServerService Thread Pool -- 31) JBAS018559: Deployed
"movieplex7-1.0-SNAPSHOT.war"
(runtime-name :
"movieplex7-1.0-SNAPSHOT.war"
)
23:54:25,563 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http:
//127
.0.0.1:9990
/management
23:54:25,563 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http:
//127
.0.0.1:9990
23:54:25,564 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final
"Tweek"
started
in
8093ms - Started 400 of 452 services (104 services are lazy, passive or on-demand)
- Find IP address of the Docker host:12
Aruns-iMac:~ arungupta$ docker-machine ip
192.168.99.100
- Access the application at http://192.168.99.100:8080/movieplex7/ to see the output as:
- List the images again:123
Aruns-iMac:~ arungupta$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
arungupta
/javaee7-hol
latest a068decaf892 4 months ago 619.7 MB
And the containers:
123Aruns-iMac:~ arungupta$ docker
ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
255a4d5b6f51 arungupta
/javaee7-hol
:latest "
/opt/jboss/wildfly/
2 seconds ago Up 1 seconds 0.0.0.0:8080->8080
/tcp
, 9990
/tcp
sick_elion
Enjoy!
Reference: | Docker 1.6 released – Docker Machine 0.2.0 from our JCG partner Arun Gupta at the Miles to go 2.0 … blog. |