Skip to toolbar
Select Page


Docker is a tool for managing linux containers -essentially a virtual file system running a linux environment of some sort. This document is a record of the construction of sc-docker -a simple linux host providing a dynamically configured nginx front end presenting R+shiny-server services maintained in a variable number of linux containers.

ubuntu 14.04

after installing it, it does not hurt to check everything is up to date

$ sudo apt-get update
$ sudo apt-get dist-upgrade

Restart if required


nginx offers some features that make it useful for the way I want to use docker -I need to add and delete proxies dynamically as docker containers are spun up or stopped to handle the user requests.

$ sudo apt-get update
$ sudo apt-get install nginx


Install the latest docker -see

Add the repository key

$ sudo apt-key adv --keyserver hkp:// --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

Add the repository to the sources used by apt

$ sudo sh -c "echo deb docker main > /etc/apt/sources.list.d/docker.list"

Install whatever version is available from this source.

$ apt-get update
$ apt-get install lxc-docker

create a docker group

$ sudo groupadd docker

then add some users to it

$ sudo usermod -a -G docker www-data
$ sudo usermod -a -G docker rcar004

You will need to add users into the docker group in order for them to use docker.

Need to access the containers from another system?

Enable forwarding to allow the docker containers to be accessed from other systems -if you do not do this, then you will only be able to access the ports on the docker instances locally -in production, this will be preferable, but at this stage, we will need to be able to test this all.

$ sudo nano /etc/default/ufw

# Change:
# to

reload the firewall configuration

sudo ufw reload

Remote API

To enable http web service connections to manage the docker instances add this configuration file into nginx/sites.available/docker-api.

upstream docker {
  server unix:/var/run/docker.sock fail_timeout=0;
server {
   listen                        6066;
location / {
      auth_basic            "closed";
      auth_basic_user_file  conf.d/api-htpasswd;
      proxy_pass                 http://docker;
      proxy_redirect             off;
      client_max_body_size       10m;
      client_body_buffer_size    128k;
      proxy_connect_timeout      90;
      proxy_send_timeout         120;
      proxy_read_timeout         120;
      proxy_buffer_size          4k;
      proxy_buffers              4 32k;
      proxy_busy_buffers_size    64k;
      proxy_temp_file_write_size 64k;


Create a password file in nginx/conf.d/api-htpasswd with

htpasswd -c conf.d/api-htpasswd

Enter a password twice. Then link the configuration to make it active and restart nginx.

ln -s sites-available/docker-api sites-enabled/docker-api
service nginx restart

Here is some more information about the Docker API.