config_unix.go 800 B

12345678910111213141516171819202122232425262728293031
  1. // +build !windows
  2. package registry // import "github.com/docker/docker/registry"
  3. import (
  4. "path/filepath"
  5. "github.com/docker/docker/pkg/homedir"
  6. "github.com/docker/docker/rootless"
  7. )
  8. // CertsDir is the directory where certificates are stored
  9. func CertsDir() string {
  10. d := "/etc/docker/certs.d"
  11. if rootless.RunningWithRootlessKit() {
  12. configHome, err := homedir.GetConfigHome()
  13. if err == nil {
  14. d = filepath.Join(configHome, "docker/certs.d")
  15. }
  16. }
  17. return d
  18. }
  19. // cleanPath is used to ensure that a directory name is valid on the target
  20. // platform. It will be passed in something *similar* to a URL such as
  21. // https:/index.docker.io/v1. Not all platforms support directory names
  22. // which contain those characters (such as : on Windows)
  23. func cleanPath(s string) string {
  24. return s
  25. }