Docker Community Forums

Share and learn in the Docker community.

Docker startup with secure connection

Hallo.

So where i work, we use docker more an more and we where looking for a wat to monitorer docker status. I dont have that much exp in this docker

So went with PRTG because we allready use that for monitoring. And with some struggle i manged to create to certificates so PRTG could connect securely, and i got it working. I got it working running this command to start Docker:

dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2376 --tlsverify=true --tlscacert=ca.pem --tlscert=server-cert.pem --tlskey=server-key.pem $other_args

So everything is good, in PRTG i can add the sensor with the client certificate i created.

But now my problem. If i reboot the VM docker starts up normally and not in “secure connection”. Then i have to login, kill my containers, stop docker, and start docker again with the command.

I read that it should be easy managing with daemon.json in /ETC/docker. I wrote this.

{
“icc”: false,
“tls”: true,
“tlsverify”: true,
“tlscacert”: “/home//DOCKERTLS/ca.pem",
“tlscert”: "/home/
/DOCKERTLS/server-cert.pem”,
“tlskey”: “/home/*****/DOCKERTLS/server-key.pem”,
“userland-proxy”: false,
“default-ulimit”: “nofile=50:100”,
“hosts”: [“unix:///var/run/docker.sock”, “tcp://0.0.0.0:2376”]
}

But docker wont start with his file. Is i remove the Host part, everything is good.

Anyone have any idea how to solve this? Or have another way of starting docker with these arguments automatic?