Skip to content

fix(docker): Use Docker SDK for startup check and compose-go#93

Merged
nfebe merged 1 commit intomainfrom
fix/docker-startup-recommended
Mar 22, 2026
Merged

fix(docker): Use Docker SDK for startup check and compose-go#93
nfebe merged 1 commit intomainfrom
fix/docker-startup-recommended

Conversation

@nfebe
Copy link
Contributor

@nfebe nfebe commented Mar 22, 2026

Replace exec.Command("docker", "info") with moby/moby client Ping() with 5s timeout context for Docker reachability check. Remove os.Setenv("DOCKER_HOST") global side effect; pass socket explicitly via client.WithHost().

Replace CLI-based compose validation (docker compose config) with compose-go/v2 SDK for in-process validation without temp files or subprocess overhead. Add validation to updateDeployment handler.

Use CLI-based detectDockerHost() with docker context inspect for socket discovery since the SDK does not resolve Docker Desktop contexts (hardcodes unix:///var/run/docker.sock).

Update deployments_path default: ~/flatrun/deployments with fallback to /var/lib/flatrun/deployments. Expand ~ in config. Add __debug_bin* and deployments/ to .gitignore.

Replace exec.Command("docker", "info") with moby/moby client
Ping() with 5s timeout for Docker reachability. Remove global
os.Setenv("DOCKER_HOST"); pass socket via client.WithHost().

Replace CLI-based compose validation with compose-go/v2 SDK
for in-process validation. Add validation to updateDeployment.

Keep CLI docker context inspect for socket discovery since SDK
does not resolve Docker Desktop contexts.

Update deployments_path default: ~/flatrun/deployments with
fallback to /var/lib/flatrun/deployments. Expand ~ in config.

Co-Authored-By: austin047 <fuhaustin@gmail.com>
Signed-off-by: nfebe <fenn25.fn@gmail.com>
@nfebe nfebe force-pushed the fix/docker-startup-recommended branch from caa8331 to 418ba9e Compare March 22, 2026 21:05
@sourceant
Copy link

sourceant bot commented Mar 22, 2026

Code Review Summary

This PR modernizes Docker interaction by moving from CLI exec calls to the Moby and Compose SDKs. It also improves environment detection for Docker Desktop users and adds proper validation to the deployment update flow.

🚀 Key Improvements

  • Switched to moby/moby SDK for Docker connectivity checks.
  • Integrated compose-go/v2 for in-process Compose file validation.
  • Implemented automatic Docker socket discovery using docker context.

💡 Minor Suggestions

  • Use filepath.Join for path construction in pkg/config/config.go.
  • Add a timeout to the docker context inspect subprocess call.

Copy link

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

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

Review complete. See the overview comment for a summary.

Copy link

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

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

Review complete. See the overview comment for a summary.

@nfebe nfebe merged commit 0e6dbbd into main Mar 22, 2026
5 checks passed
@nfebe nfebe deleted the fix/docker-startup-recommended branch March 22, 2026 21:43
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.

1 participant