Docker with Remote Access via TLS on Ubuntu 16.04

This article shows how to quickly install Docker on Ubuntu 16.04 LTS with remote TLS access. I originally created the steps while creating remote Docker instances for use with Plesk Onyx. It is assumed that you are working with a new install of Ubuntu 16.04.

Before we begin, you may wish to update your system:

Install Docker

Verify the installation:

Create Self-Signed Certificate

Use the following script (view source) to create the certificate (adapted from zigarn). Replace the parameters with appropriate values (without brackets):

  • <host_name> – The host name of your server (ex: docker.mydomain.com).
  • <public_ip> – The public IP address of your server (ex: 50.2.50.15).
  • <private_ip> – The private IP address of your server (ex: 10.10.5.20).

Update Docker Configuration

Use this script (view source) to update Docker to listen on the specified ports and use the TLS certificate:

Testing

Make sure that port 2376 is open to the public. You can test remote access by copying the ca.pem, client-cert.pem and client-key.pem certificate files from the /etc/docker/ssl/ directory to your remote client. For this example, I copied them to /root/certs (replace <remote_host> with the host name or IP address of your Docker server):

Adding a Remote Docker Server to Plesk

If you are a Plesk user and want to add a remote Docker server, you must have the paid version of the Docker extension installed. To add a remote server:

  1. Log in to Plesk and go to Tools & Settings > Docker.
  2. Click Add Server.
  3. Fill in your server details and upload your ca.pem, client-cert.pem and client-key.pem files created above. (see example below)
  4. Click OK.

If there are no connection errors, your new server will be added to the list and be available to add Docker volumes to.

Plesk Docker Add Remote Server

Leave a Reply

Your email address will not be published. * Denotes required field.
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Tip: Do you want an image (avatar) next to your posts? Sign up for a free Gravatar account. It only takes 5 minutes - simply click the "Create Your Own Gravatar" button, provide your e-mail address and upload a photo to associate with it.