Skip to content

Commit fcaf1de

Browse files
authored
Merge pull request #4386 from thaJeztah/tls_const
cli/flags: add EnvEnableTLS const for "DOCKER_TLS"
2 parents 697bd4b + 1c1329f commit fcaf1de

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

cli/flags/options.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ import (
1414
)
1515

1616
const (
17+
// EnvEnableTLS is the name of the environment variable that can be used
18+
// to enable TLS for client connections. When set to a non-empty value, TLS
19+
// is enabled for API connections using TCP. For backward-compatibility, this
20+
// environment-variable can only be used to enable TLS, not to disable.
21+
//
22+
// Note that TLS is always enabled implicitly if the "--tls-verify" option
23+
// or "DOCKER_TLS_VERIFY" ([github.com/docker/docker/client.EnvTLSVerify])
24+
// env var is set to, which could be to either enable or disable TLS certification
25+
// validation. In both cases, TLS is enabled but, depending on the setting,
26+
// with verification disabled.
27+
EnvEnableTLS = "DOCKER_TLS"
28+
1729
// DefaultCaFile is the default filename for the CA pem file
1830
DefaultCaFile = "ca.pem"
1931
// DefaultKeyFile is the default filename for the key pem file
@@ -39,8 +51,7 @@ Refer to https://docs.docker.com/go/formatting/ for more information about forma
3951
var (
4052
dockerCertPath = os.Getenv(client.EnvOverrideCertPath)
4153
dockerTLSVerify = os.Getenv(client.EnvTLSVerify) != ""
42-
// TODO(thaJeztah) the 'DOCKER_TLS' environment variable is not documented, and does not have a const.
43-
dockerTLS = os.Getenv("DOCKER_TLS") != ""
54+
dockerTLS = os.Getenv(EnvEnableTLS) != ""
4455
)
4556

4657
// ClientOptions are the options used to configure the client cli.

0 commit comments

Comments
 (0)