Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/e2e_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ permissions: {}
jobs:
test-docker:
runs-on: ubuntu-22.04
# TODO: remove this when the job gets stable
continue-on-error: true
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
Expand Down Expand Up @@ -111,6 +109,7 @@ jobs:
DOCKER_HOST="unix:///var/run/docker.sock"
DOCKER_NETWORK_NAME="kind"
CONTAINER_RUNTIME="${{ inputs.container_runtime }}"
DOCKER_API_VERSION="1.44"
EOF
# For debugging
cat docker.properties
Expand Down
6 changes: 3 additions & 3 deletions src/cloud-api-adaptor/test/e2e/docker_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"time"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
)

Expand All @@ -26,13 +26,13 @@ func (c DockerAssert) DefaultTimeout() time.Duration {
}

func (l DockerAssert) HasPodVM(t *testing.T, id string) {
conn, err := client.NewClientWithOpts(client.FromEnv)
conn, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
t.Fatal(err)
}

// Check if the container is running
containers, err := conn.ContainerList(context.Background(), types.ContainerListOptions{})
containers, err := conn.ContainerList(context.Background(), container.ListOptions{})
if err != nil {
t.Fatal(err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ func NewDockerProvisioner(properties map[string]string) (pv.CloudProvisioner, er

// set environment variables
os.Setenv("DOCKER_HOST", DockerProps.DockerHost)
if DockerProps.ApiVer != "" {
os.Setenv("DOCKER_API_VERSION", DockerProps.ApiVer)
}

conn, err := client.NewClientWithOpts(client.FromEnv)
conn, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
log.Errorf("Error creating the Docker client: %v", err)
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ CLUSTER_NAME="peer-pods"
DOCKER_HOST="unix:///var/run/docker.sock"
DOCKER_PODVM_IMAGE="quay.io/confidential-containers/podvm-docker-image"
DOCKER_NETWORK_NAME="kind"
DOCKER_API_VERSION="1.44"
CAA_IMAGE=""
CAA_IMAGE_TAG=""

Expand Down
2 changes: 1 addition & 1 deletion src/cloud-providers/docker/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (_ *Manager) ParseCmd(flags *flag.FlagSet) {

func (m *Manager) LoadEnv() {
provider.DefaultToEnv(&dockerCfg.DockerHost, "DOCKER_HOST", "unix:///var/run/docker.sock")
provider.DefaultToEnv(&dockerCfg.DockerAPIVersion, "DOCKER_API_VERSION", "1.40")
provider.DefaultToEnv(&dockerCfg.DockerAPIVersion, "DOCKER_API_VERSION", "1.44")
provider.DefaultToEnv(&dockerCfg.DockerCertPath, "DOCKER_CERT_PATH", "")
dockerTLSVerify := os.Getenv("DOCKER_TLS_VERIFY")
if dockerTLSVerify == "1" || dockerTLSVerify == "true" {
Expand Down
12 changes: 11 additions & 1 deletion src/cloud-providers/docker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,21 @@ func NewProvider(config *Config) (*dockerProvider, error) {

logger.Printf("docker config: %#v", config)

cli, err := client.NewClientWithOpts(client.FromEnv)
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion(config.DockerAPIVersion))
if err != nil {
return nil, err
}

// Log Docker client and server versions for debugging
ctx := context.Background()
serverVersion, err := cli.ServerVersion(ctx)
if err != nil {
logger.Printf("Warning: failed to get Docker server version: %v", err)
} else {
logger.Printf("Docker server version: %s, API version: %s", serverVersion.Version, serverVersion.APIVersion)
}
logger.Printf("Docker client API version: %s", cli.ClientVersion())

// Create the data directory if it doesn't exist
err = os.MkdirAll(config.DataDir, 0755)
if err != nil {
Expand Down
Loading