Skip to content

Client version too old error #606

@maggie44

Description

@maggie44

Preflight checklist

Ory Network Project

No response

Describe the bug

When running BuildAndRunWithBuildOptions the following error is produced:

API error (400): client version 1.21 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

Reproducing the bug

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/ory/dockertest/v3"
	"github.com/ory/dockertest/v3/docker"
)

func main() {
	// Create pool (docker client)
	pool, err := dockertest.NewPool("")
	if err != nil {
		log.Fatalf("failed to connect to docker: %v", err)
	}

	// Attempt build+run with minimal Dockerfile context
	const contextDir = "." // adjust to a dir containing a Dockerfile

	res, err := pool.BuildAndRunWithBuildOptions(
		&dockertest.BuildOptions{
			ContextDir: contextDir,
			Dockerfile: "Dockerfile",
			Version:    "2",
		},
		&dockertest.RunOptions{
			NetworkID:    net.ID,
			ExposedPorts: []string{"8080/tcp"},
		},
		func(hc *docker.HostConfig) {
			hc.RestartPolicy = docker.RestartPolicy{Name: "no"}
		},
	)

	if err != nil {
		log.Printf("failed to build+start container: %v", err)
		return
	}
	defer pool.Purge(res)

	fmt.Println("container started successfully")
}

Relevant log output

Relevant configuration

Version

v3.12.0

On which operating system are you observing this issue?

macOS

In which environment are you deploying?

Docker

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions