1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-11-29 05:46:50 +02:00

Supporting proxied Docker APIs through DOCKER_HOST (#70)

This commit is contained in:
Frederik Ring
2022-02-18 09:08:21 +01:00
committed by GitHub
parent 180438f1fc
commit 58b42b9036
2 changed files with 4 additions and 2 deletions

View File

@@ -90,7 +90,8 @@ func newScript() (*script, error) {
s.file = timeutil.Strftime(&s.stats.StartTime, s.file)
_, err := os.Stat("/var/run/docker.sock")
if !os.IsNotExist(err) {
_, dockerHostSet := os.LookupEnv("DOCKER_HOST")
if !os.IsNotExist(err) || dockerHostSet {
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
return nil, fmt.Errorf("newScript: failed to create docker client")