Securing the Docker daemon's remote connectivity
Earlier in this chapter, we saw how to configure the Docker daemon to accept remote connections. However, with the approach we followed, anyone can connect to our Docker daemon. We can secure our connection with Transport Layer Security (http://en.wikipedia.org/wiki/Transport_Layer_Security).
We can configure TLS either by using the existing Certificate Authority (CA) or by creating our own. For simplicity, we will create our own, which is not recommended for production. For this example, we assume that our host running the Docker daemon is dockerhost.example.com
.
Getting ready
Make sure you have the openssl
library installed.
How to do it...
- Create a directory on your host in which to put our CA and other related files:
$ mkdir -p /etc/docker/keys$ cd /etc/docker/keys
- Create the CA private and public keys:
$ openssl genrsa -aes256 -out ca-key.pem 4096 $ openssl req -new -x509 -days 365 -key ca-key.pem \ -sha256 -out ca.pem

- Now, let's...