66 "net"
77 "strings"
88
9+ "github.com/distribution/reference"
910 "github.com/docker/docker/api/types/container"
11+ "github.com/docker/docker/api/types/image"
1012 "github.com/docker/docker/api/types/network"
1113 "github.com/silenium-dev/docker-wrapper/pkg/client/stream"
1214 "k8s.io/apimachinery/pkg/util/rand"
@@ -30,6 +32,15 @@ func (c *Client) SystemHostIPFromContainers(ctx context.Context, netId *string)
3032 return nil , fmt .Errorf ("failed to check if Podman: %w" , err )
3133 }
3234
35+ imgRef , err := reference .ParseDockerRef (c .imageProvider .GetDnsUtilImage ())
36+ if err != nil {
37+ return nil , fmt .Errorf ("failed to parse image reference %s: %w" , c .imageProvider .GetDnsUtilImage (), err )
38+ }
39+ dig , err := c .ImagePullSimple (ctx , imgRef , image.PullOptions {})
40+ if err != nil {
41+ return nil , fmt .Errorf ("failed to pull image %s: %w" , imgRef .String (), err )
42+ }
43+
3344 endpoints := map [string ]* network.EndpointSettings {}
3445 if netId != nil {
3546 endpoints [* netId ] = & network.EndpointSettings {}
@@ -43,7 +54,7 @@ func (c *Client) SystemHostIPFromContainers(ctx context.Context, netId *string)
4354 cont , err := c .ContainerCreate (
4455 ctx ,
4556 & container.Config {
46- Image : c . imageProvider . GetDnsUtilImage (),
57+ Image : dig . String (),
4758 Entrypoint : command ,
4859 },
4960 & container.HostConfig {},
0 commit comments