envvars.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package client // import "github.com/docker/docker/client"
  2. const (
  3. // EnvOverrideHost is the name of the environment variable that can be used
  4. // to override the default host to connect to (DefaultDockerHost).
  5. //
  6. // This env-var is read by FromEnv and WithHostFromEnv and when set to a
  7. // non-empty value, takes precedence over the default host (which is platform
  8. // specific), or any host already set.
  9. EnvOverrideHost = "DOCKER_HOST"
  10. // EnvOverrideAPIVersion is the name of the environment variable that can
  11. // be used to override the API version to use. Value should be
  12. // formatted as MAJOR.MINOR, for example, "1.19".
  13. //
  14. // This env-var is read by FromEnv and WithVersionFromEnv and when set to a
  15. // non-empty value, takes precedence over API version negotiation.
  16. //
  17. // This environment variable should be used for debugging purposes only, as
  18. // it can set the client to use an incompatible (or invalid) API version.
  19. EnvOverrideAPIVersion = "DOCKER_API_VERSION"
  20. // EnvOverrideCertPath is the name of the environment variable that can be
  21. // used to specify the directory from which to load the TLS certificates
  22. // (ca.pem, cert.pem, key.pem) from. These certificates are used to configure
  23. // the Client for a TCP connection protected by TLS client authentication.
  24. //
  25. // TLS certificate verification is enabled by default if the Client is configured
  26. // to use a TLS connection. Refer to EnvTLSVerify below to learn how to
  27. // disable verification for testing purposes.
  28. //
  29. // WARNING: Access to the remote API is equivalent to root access to the
  30. // host where the daemon runs. Do not expose the API without protection,
  31. // and only if needed. Make sure you are familiar with the "daemon attack
  32. // surface" (https://docs.docker.com/go/attack-surface/).
  33. //
  34. // For local access to the API, it is recommended to connect with the daemon
  35. // using the default local socket connection (on Linux), or the named pipe
  36. // (on Windows).
  37. //
  38. // If you need to access the API of a remote daemon, consider using an SSH
  39. // (ssh://) connection, which is easier to set up, and requires no additional
  40. // configuration if the host is accessible using ssh.
  41. //
  42. // If you cannot use the alternatives above, and you must expose the API over
  43. // a TCP connection, refer to https://docs.docker.com/engine/security/protect-access/
  44. // to learn how to configure the daemon and client to use a TCP connection
  45. // with TLS client authentication. Make sure you know the differences between
  46. // a regular TLS connection and a TLS connection protected by TLS client
  47. // authentication, and verify that the API cannot be accessed by other clients.
  48. EnvOverrideCertPath = "DOCKER_CERT_PATH"
  49. // EnvTLSVerify is the name of the environment variable that can be used to
  50. // enable or disable TLS certificate verification. When set to a non-empty
  51. // value, TLS certificate verification is enabled, and the client is configured
  52. // to use a TLS connection, using certificates from the default directories
  53. // (within `~/.docker`); refer to EnvOverrideCertPath above for additional
  54. // details.
  55. //
  56. // WARNING: Access to the remote API is equivalent to root access to the
  57. // host where the daemon runs. Do not expose the API without protection,
  58. // and only if needed. Make sure you are familiar with the "daemon attack
  59. // surface" (https://docs.docker.com/go/attack-surface/).
  60. //
  61. // Before setting up your client and daemon to use a TCP connection with TLS
  62. // client authentication, consider using one of the alternatives mentioned
  63. // in EnvOverrideCertPath above.
  64. //
  65. // Disabling TLS certificate verification (for testing purposes)
  66. //
  67. // TLS certificate verification is enabled by default if the Client is configured
  68. // to use a TLS connection, and it is highly recommended to keep verification
  69. // enabled to prevent machine-in-the-middle attacks. Refer to the documentation
  70. // at https://docs.docker.com/engine/security/protect-access/ and pages linked
  71. // from that page to learn how to configure the daemon and client to use a
  72. // TCP connection with TLS client authentication enabled.
  73. //
  74. // Set the "DOCKER_TLS_VERIFY" environment to an empty string ("") to
  75. // disable TLS certificate verification. Disabling verification is insecure,
  76. // so should only be done for testing purposes. From the Go documentation
  77. // (https://pkg.go.dev/crypto/tls#Config):
  78. //
  79. // InsecureSkipVerify controls whether a client verifies the server's
  80. // certificate chain and host name. If InsecureSkipVerify is true, crypto/tls
  81. // accepts any certificate presented by the server and any host name in that
  82. // certificate. In this mode, TLS is susceptible to machine-in-the-middle
  83. // attacks unless custom verification is used. This should be used only for
  84. // testing or in combination with VerifyConnection or VerifyPeerCertificate.
  85. EnvTLSVerify = "DOCKER_TLS_VERIFY"
  86. )