Skip to content

Conversation

@Benehiko
Copy link
Member

@Benehiko Benehiko commented Mar 10, 2025

Closes #5900

- What I did
Propagate the failure to connect to the docker socket error up the stack.

- How I did it

- How to verify it

DOCKER_HOST=unix:///non-existent ./build/docker system info --format '{{.Architecture}}'
echo $
1
⋊> ~/G/cli-4 on info-exit-code ⨯ ./build/docker -H example.invalid info                               10:31:50
Client:
 Version:    28.0.1-108-g9949c91b3.m
 Context:    default
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v0.9.2
    Path:     /home/benehiko/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.0-desktop.1
    Path:     /home/benehiko/.pinata/downloads/docker-plugins/v0.16.0-desktop.1/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4-desktop.1
    Path:     /home/benehiko/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.38
    Path:     /home/benehiko/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Beta) (Docker Inc.)
    Version:  v0.1.5
    Path:     /home/benehiko/.docker/cli-plugins/docker-desktop
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /home/benehiko/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.27
    Path:     /home/benehiko/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     /home/benehiko/.docker/cli-plugins/docker-feedback
  harmonia: Extend your localhost with cloud workspaces (Docker Inc.)
    Version:  0.13.155
    Path:     /home/benehiko/.docker/cli-plugins/docker-harmonia
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /home/benehiko/.docker/cli-plugins/docker-init
  runx: Get a shell into any image or container (Docker Inc.)
    Version:  dev
    Path:     /home/benehiko/.docker/cli-plugins/docker-runx
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /home/benehiko/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.16.1
    Path:     /home/benehiko/.docker/cli-plugins/docker-scout
  x: Experimental plugin for the Docker CLI (Docker Inc.)
    Version:  dev
    Path:     /home/benehiko/.docker/cli-plugins/docker-x

Server:
error during connect: Get "http://example.invalid:2375/v1.48/info": dial tcp: lookup example.invalid: no such host
⋊> ~/G/cli-4 on info-exit-code ⨯ echo $status                                                         10:31:52
1

- Human readable description for the release notes

`docker system info` will provide an exit code if a connection cannot be established to the Docker daemon

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

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 59.27%. Comparing base (2d74733) to head (353230d).
Report is 3 commits behind head on master.

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5918      +/-   ##
==========================================
- Coverage   59.33%   59.27%   -0.07%     
==========================================
  Files         358      358              
  Lines       29783    29837      +54     
==========================================
+ Hits        17672    17685      +13     
- Misses      11142    11180      +38     
- Partials      969      972       +3     
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@Benehiko Benehiko added this to the 28.0.2 milestone Mar 10, 2025
@Benehiko Benehiko requested a review from a team March 10, 2025 14:43
@Benehiko Benehiko marked this pull request as ready for review March 10, 2025 14:43
@Benehiko Benehiko force-pushed the info-exit-code branch 2 times, most recently from 56e6f6a to 7bec8d4 Compare March 11, 2025 09:56
@Benehiko Benehiko force-pushed the info-exit-code branch 3 times, most recently from b69b09a to c899a20 Compare March 12, 2025 09:36
…uld propagate error

This patch propagates the error up the stack when running `docker info`
and a connection error to the server occurs.

Signed-off-by: Alano Terblanche <[email protected]>
@vvoland vvoland modified the milestones: 28.0.2, 28.0.3 Mar 19, 2025
@Benehiko
Copy link
Member Author

@thaJeztah PTAL :)

@thaJeztah
Copy link
Member

Ah, sorry, I should've replied; I started reviewing, but ran into some other fun issues; will give this another look today 👍

@vvoland vvoland modified the milestones: 28.0.3, 28.0.4, 28.0.5 Mar 25, 2025
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

🙈 thought this one was already merged 🙈

@thaJeztah thaJeztah merged commit ac375ca into docker:master Apr 10, 2025
87 checks passed
@thaJeztah thaJeztah modified the milestones: 28.0.5, 28.1.0 Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants