Skip to content

Commit

Permalink
Respect DOCKER_HOST env var for better container runtime Support (#165)
Browse files Browse the repository at this point in the history
DOCKER_HOST is now respected so the binary could be run again other
runtimes like podman, that exposes a compatible socket based api.
To use it export DOCKER_HOST=unix:///run/user/1000/podman/podman.sock
for running with a non root user.

If DOCKER_HOST is not exported then the default path
/var/run/docker.socket

Signed-off-by: Roy Golan <rgolan@redhat.com>
  • Loading branch information
rgolangh authored Jul 11, 2024
1 parent 29a1df5 commit a96f93f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ func (*FileSystem) GetSupportInfo() map[string]string {
}
}
info["docker"] = "docker socket is mounted"
if _, err := os.Stat("/var/run/docker.sock"); err != nil {
dockerHost := os.Getenv("DOCKER_HOST")
if dockerHost == "" {
dockerHost = "/var/run/docker.socket"
}
if _, err := os.Stat(dockerHost); err != nil {
if os.IsNotExist(err) {
info["docker"] = "docker socket is not mounted"
} else {
Expand Down

0 comments on commit a96f93f

Please sign in to comment.