Skip to content

Requests get a double API version path with daemons below API 1.45 (Podman) #78

Closed

Description

@AdzerKI

Since 1.2.0 (#75, docker-php 4) the default client can't talk to a daemon whose max API version is below 1.45, e.g. Podman (it reports 1.41). Every container start fails with Docker\Exception\BadRequestException: Failed to decode JSON.

DockerClientFactory::createFromEnv() in docker-php 4 already negotiates the API version and adds the /v<negotiated> path. DockerContainerClient then passes this client to Docker::create($httpClient) with server plugins on, so the generated /v1.45 path is added too. The request becomes /v1.41/v1.45/info and the daemon answers 404 with plain text. Against Docker 1.45+ the two prefixes are the same, so it goes unnoticed.

docker-php docs say to pass false as the 4th argument for a factory client: https://github.com/docker-php/docker-php/blob/main/docs/connection.mdx

Fix: apply the server plugins only when a custom HTTP client factory is injected. PR follows.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions