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.

  • Managing a group of docker containers without the sweat
  • how to find MAX memory from docker stats?
  • Upgrade of Docker from Swarm to Swarm Mode - is recreation of containers needed?
  • Keep Data on Embedded database during deploy
  • MYSQLI Connection refused when connecting to another docker container running MariaDB
  • Access docker bridge using docker exec
  • 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?

  • Enable webcam in docker application and access thru AWS ECS
  • Error 500 access in rails app with puma and nginx
  • Like “make” for Docker
  • Enable logging in docker mysql container
  • Jenkins in docker with access to host docker
  • How to set image name in Dockerfile?
  • 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": "",

    The --config-file option 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.json on Linux and %programdata%\docker\config\daemon.json on Windows.

    On the client side, you need to set the docker-machine env variables:

    For instance:

    $ docker-machine.exe env --shell cmd dev
    set DOCKER_HOST=tcp://
    set DOCKER_CERT_PATH=C:\Users\captain\.docker\machine\machines\dev
    # Run this command to configure your shell: copy and paste the above values into your command prompt

    (Replace dev with the name of your machine)

    Make sure DOCKER_CERT_PATH refers to a folder which includes your certificate.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.