Skip to content

Commit

Permalink
i think we dont need to manually set the host?
Browse files Browse the repository at this point in the history
  • Loading branch information
nadim-az committed Feb 6, 2025
1 parent 683a839 commit eda7b90
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions core/provider/clients/docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package clients
import (
"context"
"fmt"
"io"
"net"
"os"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
Expand All @@ -15,6 +11,8 @@ import (
dockerclient "github.com/docker/docker/client"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"go.uber.org/zap"
"io"
"net"
)

// DockerClient is a unified interface for interacting with Docker
Expand Down Expand Up @@ -70,16 +68,10 @@ func NewDockerClient(host string, dialFunc func(ctx context.Context, network, ad
if dialFunc != nil {
opts = append(opts, dockerclient.WithDialContext(dialFunc))
}
logger, _ := zap.NewProduction()
logger.Info("HOST DEBUG", zap.String("host", host))

if host != "" {
logger.Info("docker client using custom host", zap.String("host", host))
host = fmt.Sprintf("tcp://%s:2375", host)
os.Setenv("DOCKER_HOST", fmt.Sprintf("tcp://%s:2375", host))
logger.Info("docker_host: " + os.Getenv("DOCKER_HOST"))
opts = append(opts, dockerclient.WithHost(host))
opts = append(opts, dockerclient.WithVersion("1.45"))
}

client, err := dockerclient.NewClientWithOpts(opts...)
Expand Down

0 comments on commit eda7b90

Please sign in to comment.