Using TLS for docker

141 Views Asked by At

I have a linux server with docker installed on it and I access the container via IP:port1 using my windows laptop browser (each container is assigned a port). I got the certificate files for both server and client as per https://docs.docker.com/engine/security/protect-access/ guide. Now to make the Docker daemon only accept connections from clients that present your CA's trusted certificate, I need to use this command:

for server:
$ dockerd \
    --tlsverify \
    --tlscacert=ca.pem \
    --tlscert=server-cert.pem \
    --tlskey=server-key.pem \
    -H=0.0.0.0:2376

for client:
$ docker --tlsverify \
    --tlscacert=ca.pem \
    --tlscert=cert.pem \
    --tlskey=key.pem \
    -H=$HOST:2376 version

Note: Docker over TLS must be running on TCP port 2376. My first question is: the port mentioned above "2376" is different from the port specified for the container, does this cause problems? What should I do ? And second question: in my case the Docker client machine is my Windows laptop, please explain the steps I need to do on my laptop to make a TLS connection to my server?

I've got certificate files .I haven't done any more.

0

There are 0 best solutions below