Setting TLS opptions for Docker as Environment Variables
I’ve got the local docker daemon running using certificates and I can list all the running containers using the very long winded command like
docker --tlsverify --tlscacert=/path/ca.cer --tlscert=/path/client.cert --tlskey=/path/client.key -H=localhost:2376 ps
But when I run
docker ps I get a
bad certificate error since the various tls options from the above command are not passed to docker. I have spent a number of hours going through the docker website and can’t find any options on how to set them.
I have set
DOCKER_CERT_PATH, but it doesn’t seem to work.
Is there a
DOCKER_CACERT environment variable that docker would read if
--tlscacert is not specified?
One Solution collect form web for “Setting TLS opptions for Docker as Environment Variables”
Those options should be set in the docker daemon config file
"tls": true, "tlsverify": true, "tlscacert": "", "tlscert": "", "tlskey": "",
--config-fileoption allows you to set any configuration option for the daemon in a JSON format.
By default, docker tries to load a configuration file from
/etc/docker/daemon.jsonon Linux and
On the client side, you need to set the
docker-machine env variables:
$ docker-machine.exe env --shell cmd dev set DOCKER_TLS_VERIFY=1 set DOCKER_HOST=tcp://192.168.99.101:2376 set DOCKER_CERT_PATH=C:\Users\captain\.docker\machine\machines\dev set DOCKER_MACHINE_NAME=dev # Run this command to configure your shell: copy and paste the above values into your command prompt
dev with the name of your machine)
DOCKER_CERT_PATH refers to a folder which includes your certificate.