mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use certs.d
from XDG_CONFIG_HOME when in rootless mode Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
This commit is contained in:
parent
2808762b27
commit
f4fa98f583
1 changed files with 16 additions and 1 deletions
|
@ -16,6 +16,9 @@ import (
|
||||||
"github.com/docker/distribution/registry/client/transport"
|
"github.com/docker/distribution/registry/client/transport"
|
||||||
"github.com/docker/go-connections/tlsconfig"
|
"github.com/docker/go-connections/tlsconfig"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/docker/docker/pkg/homedir"
|
||||||
|
"github.com/docker/docker/rootless"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -31,7 +34,19 @@ func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) {
|
||||||
tlsConfig.InsecureSkipVerify = !isSecure
|
tlsConfig.InsecureSkipVerify = !isSecure
|
||||||
|
|
||||||
if isSecure && CertsDir != "" {
|
if isSecure && CertsDir != "" {
|
||||||
hostDir := filepath.Join(CertsDir, cleanPath(hostname))
|
certsDir := CertsDir
|
||||||
|
|
||||||
|
if rootless.RunningWithRootlessKit() {
|
||||||
|
configHome, err := homedir.GetConfigHome()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
certsDir = filepath.Join(configHome, "docker/certs.d")
|
||||||
|
}
|
||||||
|
|
||||||
|
hostDir := filepath.Join(certsDir, cleanPath(hostname))
|
||||||
|
|
||||||
logrus.Debugf("hostDir: %s", hostDir)
|
logrus.Debugf("hostDir: %s", hostDir)
|
||||||
if err := ReadCertsDirectory(tlsConfig, hostDir); err != nil {
|
if err := ReadCertsDirectory(tlsConfig, hostDir); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue