Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the DOCKER_TLS_VERIFY and DOCKER_CERT_PATH variable do?

I am new to Docker, using boot2docker on Windows 7.
While I was trying to configure Docker build through spotify maven plugin, I was asked to set below env variables :

DOCKER_HOST
DOCKER_CERT_PATH
DOCKER_TLS_VERIFY

Configuration was successful but am not sure What does the DOCKER_TLS_VERIFY and DOCKER_CERT_PATH variables do ?

like image 508
Aniketh Avatar asked Jul 02 '15 05:07

Aniketh


People also ask

What is Docker_tls_verify?

DOCKER_TLS_VERIFY is a environment variable and not a docker daemon config file options. See: https://docs.docker.com/engine/reference/commandline/dockerd/#/daemon-configuration-file for the documentation.

What is Docker_cert_path?

DOCKER_CERT_PATH. Configures the path to the ca. pem , cert. pem , and key. pem files used for TLS verification.

What is Docker_host?

“DOCKER_HOST” tells the client how to connect to the daemon. The default is a local socket.

Where are Docker container environment variables stored?

It's not stored (in a file) anywhere. It's passed from Docker to the process running in the container.


1 Answers

Please check below comments for now. I'm not a Go developer but I understand usage from it. To be edited later as it is too Spartan.

from https://github.com/docker/docker/blob/3ea762b9f6ba256cf51bd2c35988f0c48bccf0b0/client/client.go

[...]
// Use DOCKER_HOST to set the url to the docker server.
// Use DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
// Use DOCKER_CERT_PATH to load the tls certificates from.
// Use DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
func NewEnvClient() (*Client, error) {
    var client *http.Client
    if dockerCertPath := os.Getenv("DOCKER_CERT_PATH"); dockerCertPath != "" {
        options := tlsconfig.Options{
            CAFile:             filepath.Join(dockerCertPath, "ca.pem"),
            CertFile:           filepath.Join(dockerCertPath, "cert.pem"),
            KeyFile:            filepath.Join(dockerCertPath, "key.pem"),
            InsecureSkipVerify: os.Getenv("DOCKER_TLS_VERIFY") == "",
[...]
like image 78
dim Avatar answered Sep 19 '22 08:09

dim