---
title: Test driving the Docker Universal Control Plane
description: The Docker Universal Control Plane (UCP) is the commercial management solution for containerised applications inside a public cloud or on-premise. It is built on top of Docker Swarm. All UCP components are also running as containers.
image: http://cdn2.hubspot.net/hubfs/2668666/All-InOne-2016/Image/bg-img.jpg
---

Check out our **[Cloud Native Services](https://www.container-solutions.com/services) **and** **book a call with one of our experts today! 

[![Container Solutions](https://blog.container-solutions.com/hubfs/CS_blog/logo-main.svg "Container Solutions")](http://container-solutions.com)

- share:
- [**](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fblog.container-solutions.com%2Ftest-driving-the-docker-universal-control-plane)
- [**](https://www.twitter.com/share?url=https%3A%2F%2Fblog.container-solutions.com%2Ftest-driving-the-docker-universal-control-plane)
- [**](http://www.linkedin.com/shareArticle?mini=true&url=https://blog.container-solutions.com/test-driving-the-docker-universal-control-plane)
- [**](https://blog.container-solutions.com/test-driving-the-docker-universal-control-plane#)

[![](http://cdn2.hubspot.net/hubfs/2668666/All-InOne-2016/Image/bg-img.jpg) ](https://blog.container-solutions.com/test-driving-the-docker-universal-control-plane)

# Test driving the Docker Universal Control Plane

[Michael Müller](https://blog.container-solutions.com/author/michael-müller)

![Michael Müller](https://blog.container-solutions.com/hubfs/CS--Dev__Assets/asset%2017.jpeg)

 February 22, 2016

 12 minutes Read

The Docker Universal Control Plane (UCP) is the commercial management solution for containerised applications inside a public cloud or on-premise. It is built on top of Docker Swarm. All UCP components are also running as containers.

This post will guide you through the installation of UCP and the integration of [Interlock](https://github.com/ehazlett/interlock) to dynamically configure [HAProxy](http://www.haproxy.org/) as a load balancer.

#### Installation

Docker provides an [ucp tool](https://docs.docker.com/ucp/production-install/) to install the required components. The ucp tool runs via Docker and launches the appropriate containers.  It comes with subcommands such as “install”, “join” or “uninstall”. For an overview of all possible commands, use:

```
  
docker run --rm -it docker/ucp  --help
```

There is an interactive installation method which guides you through the process, launch it like this.

```
  
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --name ucp docker/ucp install -i --host-address 172.17.9.102
```

As we use vagrant for this setup `--host-address` is used to supply the installer with an accessible host address. In this case the static assigned IP address of the bridged interface (172.17.9.102). To be able to manage your host containers from within a container you need to mount the Docker socket into the container.

The command will pull several images and will prompt for values it needs to complete the installation. When it completes, the command prompts you to login into the UCP GUI.

```
 
INFO[0015] Login as "admin"/(your admin password) to UCP at https://172.17.9.102:443
```

To add a controller replica for high availability,  run the UCP tool on another server with the “--replica” flag. To achieve high availability you need at least 2 replicas.

```
  
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --name ucp docker/ucp join --replica -i --host-address 172.17.9.103
```

Now add an Engine node to the UCP cluster:

```
  
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --name ucp docker/ucp join -i --host-address 172.17.9.104
```

The UCP cluster is now up and running, let’s see what we can do with it.

#### Running

We’ll deploy a container via the GUI therefore navigate to *Containers* and *Deploy Container*

 

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/image12-1.png?width=434&name=image12-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/image12-1.png)

 

Fill out the form to start the container with the desired values

 

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Blog%20Images/pic11_tinyjpg.png?width=650&name=pic11_tinyjpg.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/pic11-1.png)

 

Press “Run Container” on the right and the container will be started. This container is accessible on port 8080. If everything went well, you’ll see:

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/Picture3-1-1.png?width=690&name=Picture3-1-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/Picture3-1-1.png)

You can test this by:

```
  
curl -i http://172.17.9.105:8080
(out)HTTP/1.1 200 OK
(out)X-Powered-By: Express
(out)Content-Type: text/html; charset=utf-8
(out)Content-Length: 12
(out)ETag: W/"c-8O9wgeFTmsAO9bdhtPsBsw"
(out)Date: Thu, 18 Feb 2016 11:04:35 GMT
(out)Connection: keep-alive
(out) 
(out)Hello world
```

It will just return a simple “Hello world”.  
 The same can be achieved via the CLI. Connect to one of the nodes and run:

```
  
docker run -d -p 8081:8080 --name hello-world-cli-v1 muellermich/nodejs-hello
```

You’ll see the container running using:

```
  
docker ps 
(out)CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                     NAMES
(out)13d9f6710e48        muellermich/nodejs-hello   "npm start"              3 seconds ago       Up 3 seconds        0.0.0.0:8081->8080/tcp    hello-world-cli-v1
(out)6d69aa8e1a7d        muellermich/nodejs-hello   "npm start"              4 minutes ago       Up 4 minutes        0.0.0.0:8080->8080/tcp    hello-world-gui-v1
  
```

Or the GUI:

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/Picture4-1-1.png?width=690&name=Picture4-1-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/Picture4-1-1.png)

To verify that the application is running, access the container from outside by identifying the node and port that the container is running on.

Let's add a load balancer to the setup and service discovery so containers get automatically registered.

We will use HAProxy as the load balancer, also running in a container. For service discovery, we use [Interlock](https://github.com/ehazlett/interlock) from Docker employee [Evan Hazlett](https://github.com/ehazlett). Interlock is described as “Dynamic, event-driven Docker plugin system using Swarm”. It makes use of the event stream of Docker Swarm  and the [Docker API](https://docs.docker.com/engine/reference/api/docker_remote_api/). This allows interlock to listen for container events like starting and stopping and take action based on them.

It uses the Docker API to fetch some attributes about the started or stopped containers, such as service name, hostname, host IP and port. Based on this information, a new HAProxy configuration is deployed.  
 We'll use docker-compose to launch interlock on the UCP Cluster. That way, interlock will also show up as new application in UCP. The compose file looks like this:

```
 
version: "2"
services:
  interlock:
    image: ehazlett/interlock:latest
    command: "--swarm-url tcp://172.17.9.102:2376 --swarm-tls-ca-cert /data/ca.pem --swarm-tls-cert /data/cert.pem --swarm-tls-key /data/key.pem --plugin haproxy start"
    restart: always
    environment:
      - "affinity:container==ucp-swarm-manager"
    ports:
      - "80:80"
    volumes:
      - "/var/lib/docker/volumes/ucp-swarm-node-certs/_data:/data:ro"
  
```

On the master, we just have to issue:

```
  
docker-compose up -d
```

This will bring up a container with HAProxy running. You can access the stats page of HAProxy by accessing: `http://172.17.9.102/haproxy?stats`

[![pic5Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/pic5-1-1.png?width=700&name=pic5-1-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/pic5-1-1.png)

In the GUI under the application tab, you’ll now find the newly created application.

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/pic6-1-1.png?width=700&name=pic6-1-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/pic6-1-1.png)

Now let's start a new container from the CLI and register this container with our newly created HAProxy:

```
  
docker run -d -P -e INTERLOCK_DATA='{"hostname":"cli","domain":"ucp-ha.demo"}' --name hello-world-ha-cli muellermich/nodejs-hello
```

`-P` publishes all exposed ports inside the container to random ports on the host. We also pass an environment variable `-e INTERLOCK_DATA='{"hostname":"cli","domain":"ucp-ha.demo"}'` to tell interlock that this container will have the URL `http://cli.ucp-ha.demo/`.

The HAProxy config is automatically recreated, which you can see on the status page of HAProxy:

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/image06-1-1.png?width=803&name=image06-1-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/image06-1-1.png)

The application inside the container we just launched can be access via the browser or via curl. It will just prompt “Hello World”:

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/image08-1.png?width=300&name=image08-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/image08-1.png)

Below you can see how interlock works and recreates the HAProxy configuration.

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Blog%20Images/image11_tinyjpg.png?width=622&name=image11_tinyjpg.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/image11-1.png)

The same can be achieved via the GUI: You need to enter the container details like above, add the environment variable for interlock and select to automatically expose all ports.

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Blog%20Images/pic10_tinyjpg.png?width=1000&name=pic10_tinyjpg.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/pic10-1.png)

This again will generate the corresponding HAProxy config

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/image03-1-1.png?width=793&name=image03-1-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/image03-1-1.png)

You can now easily scale your application up using the GUI. Navigate to your container and click on the sliders icon. Then navigate to the right top to “scale”. Enter the number you want to scale up e.g.: 10 and this will spin up 10 new containers and reconfigure HAProxy.

[![Test driving the Docker Universal Control Plane](https://blog.container-solutions.com/hs-fs/hubfs/Imported_Blog_Media/image09-1-1.png?width=821&name=image09-1-1.png)](https://blog.container-solutions.com/hubfs/Imported_Blog_Media/image09-1-1.png)

#### Closing thoughts

The setup of a cluster for Docker containers is simple and straightforward. With the addition of interlock, it’s a good starting point for a container infrastructure.

 

But there is still work to do: Rescheduling is missing even though there is now basic support for it in Docker swarm 1.1 (experimental). I couldn’t find a way to convince UCP to start Docker Swarm in experimental mode, but I’m pretty sure this will be added in one of the next releases.

If you want to know more about rescheduling in Docker Swarm, please read the article [Rescheduling containers on node failures with Docker Swarm 1.1](http://container-solutions.com/rescheduling-containers-on-node-failures-with-docker-swarm-1-1/) by Maximilian Schoefmann.

[### Weather Predictions Straight from the Cloud

](https://blog.container-solutions.com/weather-predictions-straight-from-the-cloud)

[![prev-arrow](https://cdn2.hubspot.net/hubfs/3842749/Wow%202019/Images/left-arrow.png) Previous article](https://blog.container-solutions.com/weather-predictions-straight-from-the-cloud)

[ Next article ![next-arrow](https://cdn2.hubspot.net/hubfs/3842749/Wow%202019/Images/right-arrow.png) ](https://blog.container-solutions.com/user-access-manager-application-on-mantl)

[

### User Access Manager application on Mantl

](https://blog.container-solutions.com/user-access-manager-application-on-mantl)

Comments

Leave your Comment

![cs-logo-white](https://blog.container-solutions.com/hs-fs/hubfs/cs-logo-white.png?width=150&height=61&name=cs-logo-white.png "cs-logo-white")

#### **Talk to sales**

[info@container-solutions.com](mailto:info@container-Solutions.com)

#### Stay In Touch

- [**](https://www.linkedin.com/company/container-solutions/)
- [**](https://twitter.com/containersoluti)

© 2024 Container Solutions