Skip to content

Conversation

@thaJeztah
Copy link
Member

Some validation steps done by docker create (and docker run) are platform- specific, and need to know the daemon's OS.

To get this information, the CLI.ServerInfo() method was used, which discards connection errors, resulting in an empty OS, which causes validation to fail with an "unknown server OS" error message.

This patch changes it to use the Client.Ping so that we can error when failing to connect.

We should look if we can reduce the platform-specific validation and parsing on the client-side, but at least this change should produce a more useful error.

Before this patch:

DOCKER_HOST=tcp://example.invalid docker run -it --rm --device=/dev/dri alpine
docker: unknown server OS:

Run 'docker run --help' for more information

With this patch:

DOCKER_HOST=tcp://example.invalid docker run -it --rm --device=/dev/dri alpine
failed to connect to the docker API at tcp://example.invalid:2375: lookup example.invalid on 192.168.65.7:53: no such host

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah
Copy link
Member Author

Ah, dang; looks like I need to update some tests

@codecov-commenter
Copy link

codecov-commenter commented Dec 11, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/command/container/create.go 50.00% 1 Missing and 1 partial ⚠️
cli/command/container/run.go 50.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah thaJeztah force-pushed the fix_validation branch 2 times, most recently from 582d016 to 675e209 Compare December 11, 2025 15:55
Some validation steps done by `docker create` (and `docker run`) are platform-
specific, and need to know the daemon's OS.

To get this information, the CLI.ServerInfo() method was used, which
discards connection errors, resulting in an empty OS, which causes
validation to fail with an "unknown server OS" error message.

This patch changes it to use the Client.Ping so that we can error when
failing to connect.

We should look if we can reduce the platform-specific validation and parsing
on the client-side, but at least this change should produce a more useful
error.

Before this patch:

    DOCKER_HOST=tcp://example.invalid docker run -it --rm --device=/dev/dri alpine
    docker: unknown server OS:

    Run 'docker run --help' for more information

With this patch:

    DOCKER_HOST=tcp://example.invalid docker run -it --rm --device=/dev/dri alpine
    failed to connect to the docker API at tcp://example.invalid:2375: lookup example.invalid on 192.168.65.7:53: no such host

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah merged commit ca0fb17 into docker:master Dec 11, 2025
120 of 123 checks passed
@thaJeztah thaJeztah deleted the fix_validation branch December 11, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown server OS error on Ubuntu 24.04.3 LTS

3 participants