Skip to content

Commit 43b9434

Browse files
committed
feat: support version negotiation
1 parent c61a928 commit 43b9434

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

examples/pull/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func main() {
2525
cli, err := client.NewWithOpts(
2626
client.WithAuthProvider(override),
2727
client.FromEnv,
28+
client.WithVersionNegotiation,
2829
client.WithDockerOpts(client2.WithTimeout(time.Hour*1)),
2930
client.WithSugaredLogger(logger.With(zap.String("component", "docker-client"))),
3031
)

pkg/client/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ func (c *Client) Close() error {
4646
return c.Client.Close()
4747
}
4848

49+
func WithVersionNegotiation(c *Client) error {
50+
c.dockerOpts = append(c.dockerOpts, client.WithAPIVersionNegotiation())
51+
return nil
52+
}
53+
4954
func WithAuthProvider(authProvider auth.Provider) Opt {
5055
return func(c *Client) error {
5156
c.authProvider = authProvider

0 commit comments

Comments
 (0)