Managing Docker On Ubuntu 17.04 Using Rancher Or Portainer

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)

Installing Managing Docker 17.03.1-ce On The Latest Ubuntu Beta

Updating Ubuntu to 17.04

First I am going to upgrade Ubuntu from 16.10 to 17.04
Requirements for the upgrade is below.

  • Install the update-manager-core package if it is not already installed
  • Make sure the Prompt line in /etc/update-manager/release-upgrades is set to normal
  • Run do-release-upgrade -d
  • The system will require a reboot once complete

Installing Docker 1.17.x On Ubuntu 17.04

Modify /etc/apt/sources.list, change from zesty to yakkety

Finally, update/install Docker.

Verify your installation worked as expected and Docker is version 17.03.1-ce

Configure a proxy (if needed)

Note: If you need to bypass a proxy accessing an outside network, create the below entry’s.

Verify, then Restart the service if all looks good

Working with Docker

Now that Docker is working, first lets pull the Docker Registry and Images

Pulling the Docker Registry and Images

Lets create / start an ubuntu ssh container

Now, lets create a Docker container with CPU/Memory resource controls

Note: The below ssh-test container is set with a resource limit of CPU 1 core, and Memory is set to 10Mb.

Now, lets test this resource limits, to stress the Docker container CPU and Memory, just run the below and watch the docker stats.
Run the below to stress the CPU – Reference – how to cpu hog load test

Ssh to localhost port 2022 (the Docker exposed port configured above).
To stress the CPU, create a file with the below content (don’t worry it wont blow up on you 🙂 )

Run the CPU stress test, when completed just hit CTRL+C to terminate the process.
Just check top or docker stats to see it using only 1 core.

Now, to test Memory resource control

Run the below to lock about 98% (7-9Mb) of Memory (total available resource memory is about 10Mb).

Now, lets check the container CPU and Memory resource status.

Lets explorer Docker Volume and File System options

For this test I am going to create an empty block file filled with zeros. this will be used as an exposed file system.

Creating an empty volume

Use fallocate to crate a 2Gb empty blob.

Create a Docker container with the above volume and mount

Notice the -v option for volume.

Login to the container and verify the /vol a 2Gb File System.

Shared Volumes or File Systems

Note: To use volumes and or shared File Systems you need a Docker driver.
Flocker is a very common driver used but requiters a separate installation and configuration, described below.

Installing and Configuring Flocker

Note: I am still working on a full easy/clean Flocker installation and its still a working progress, as I ran in to some issues with Ubuntu 17.x pre-release.

Configure and add the flocker repo

Run the below to create the flocker entry’s

Update the system repo cache and install the Flocker cluster system.

Note: Additional Flocker configuration is required to get it working. will update below once that is available.

Now, that flocker is working, lets create a flocker volume

To Create a shared Flocker volume, use one of the two options below.
Option 1: Use a pre created volume

Option 2: Create a Docker Flocker volume.

Note: You can just migrate/use this volume on any other Docker Flocker host part of this Flocker cluster.

Initializing Docker Swarm

To use Docker Swarm you first need to initialize it.
Initializing Docker swarm by running the below.

Verify Docker swarm working

Docker and Docker Swarm Web UI(GUI)

I explored multiple Docker UI Managers, some of them work better then others (especially out of the box).
Below I will show two options I played with. Portainer and Rancher, both have there plus and mines.
Note: Tutum is also a nice option, its now part of Docker called Docker Cloud I have not had a chance to test it.

So lets jump right into it.

Installing Portainer

The first one to test was Portainer, installation was very simple, its a rely small application (about 3Mb).
Getting it up and running was not more then the install/pull request below, which exposes port 9000 to access with the web-ui.

Just run the below to install and configure Portainer.

After connection to the UI for the first time it will ask you to set an admin password.
Below are a a few Portainer screen shuts.

Portainer Main Dashboard

Portainer Container View

Portainer Container Monitor

Now, lets discuss a bit about Rancher Labs, Rancher is a much wider application, therefore requires a bit more configuration.

Installing Rancher Labs

To install the Rancher server just run the below, this will expose port 8000 for managing with the web ui.

With Portainer it was simple once the application connects with a socket /var/run/docker.sock. but with Rancher it requires a bit more configuration.

After connecting to the Rancher web ui for the first time, you will need to click on Add Host, you will then get a form to complete which will generate something like the below, run that in your terminal.

Note: Its possible you will need to login to the container and add your servers name and ip (and your porxy name and ip), then reboot that container to connect.

After issuing the above commend, ranger will configure a number of containers used for his own services, for example ipSec, etc…

Once setup completes adding your container hosts. working in the UI is very nice and powerful.
Below are a few Rancher screen shuts.

Rancher Environment Support

Rancher Stack Service

Rancher Host Monitor

Rancher Container View

Rancher Catalog

Come back to see more on – Configuration Automation with Chef and Docker


Rancher Installation
Docker Configuration Options

You might also like Using Chef Kitchen / Docker Build Behind a Corporate Proxy or Firewall.

What tools did you experience managing Docker on Ubuntu? Please let me know in the comments below.

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Bablofil Recent comment authors
newest oldest most voted
Notify of

Thanks, great article.