Skip to content

Conversation

Copy link

Copilot AI commented Dec 19, 2025

When DOCKER_API_VERSION is set in the environment (e.g., to 1.25), lazydocker fails with "client version 1.25 is too old" even though API version negotiation is enabled.

Root Cause

client.FromEnv includes WithVersionFromEnv(), which sets manualOverride=true when DOCKER_API_VERSION is present. This disables negotiation even when WithAPIVersionNegotiation() is specified.

Changes

pkg/commands/docker.go

  • Replace client.FromEnv with explicit options: WithTLSClientConfigFromEnv(), WithAPIVersionNegotiation(), WithHost()
  • Exclude WithVersionFromEnv() to prevent manual override from blocking negotiation
// Before
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation(), client.WithHost(dockerHost))

// After
cli, err := client.NewClientWithOpts(
    client.WithTLSClientConfigFromEnv(),
    client.WithAPIVersionNegotiation(),
    client.WithHost(dockerHost),
)

This ensures the client always negotiates the API version with the daemon, providing backwards compatibility regardless of environment variable settings.

Original prompt

This section details on the original issue you should resolve

<issue_title>Docker compose version: "client version 1.25 is too old"</issue_title>
<issue_description>> This is fixed in the latest release (v0.24.2). Thank you all for your patience.

Originally posted by @jesseduffield in #698

Hi all,

I appreciate all the work and the great app.
I just tried to install & run lzd but I got stuck when trying to start it

❯ lzd
2025/11/27 08:38:03 An error occurred! Please create an issue at https://github.com/jesseduffield/lazydocker/issues

*errors.withStack Error response from daemon: client version 1.25 is too old. Minimum supported API version is 1.44, please upgrade your client to a newer version
/tmp/gobuild/main.go:96 (0x835285)
/usr/local/go/src/runtime/proc.go:250 (0x436332)
/usr/local/go/src/runtime/asm_amd64.s:1571 (0x463681)

Is there any fix I can perform on my Debian docker environment?
The compose file looks pretty straight forward.


services:
lazydocker:
build:
context: https://github.com/jesseduffield/lazydocker.git
args:
BASE_IMAGE_BUILDER: golang
GOARCH: amd64
GOARM:
image: lazyteam/lazydocker
container_name: lazydocker
stdin_open: true
tty: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/.config/jesseduffield/lazydocker

PS. I am aware about the workaround with the docker service file but I don't want to go that route</issue_description>

<agent_instructions>Perhaps we can add some backwards compatibility support</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…iation

Replace client.FromEnv with individual options to avoid WithVersionFromEnv
which prevents API version negotiation when DOCKER_API_VERSION is set

Co-authored-by: jesseduffield <8456633+jesseduffield@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Docker client to resolve version error Fix Docker API version negotiation when DOCKER_API_VERSION is set Dec 19, 2025
Copilot AI requested a review from jesseduffield December 19, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker compose version: "client version 1.25 is too old"

2 participants