devcontainers / devcontainers/cli

devcontainer exec: no error message when Docker is not running on macOS

Open
#1,187 0 comments 0 reactions 1 assignee Claimed by @v-Kaniska244 View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
457
Avg merge
13h 17m
Merged PRs (30d)
6

Description

## Problem
When running `devcontainer exec` command on macOS without Docker Desktop installed or running, the command exits with a non-zero exit code, but **no error message is displayed** on stderr. This forces developers to guess what went wrong.

## Expected Behavior
The application should display a clear error message on stderr explaining that Docker cannot be reached, similar to what the `docker` CLI does.

## Current Behavior
```bash
$ devcontainer exec poetry --version
# No output, just exits with code 1
```

## Example of Good Error Messaging
The `docker` CLI provides helpful feedback:
```bash
$ docker ps
Cannot connect to the Docker daemon at unix:///Users/kamil/.docker/run/docker.sock. Is the docker daemon running?
```

## Impact
Poor error messaging negatively affects developer experience (DX). Users can't quickly diagnose issues and must resort to debugging or searching through documentation.

## Suggested Solution
When `devcontainer exec` fails to connect to Docker, it should print a descriptive error message to stderr, similar to:
```
Error: Cannot connect to Docker daemon. Is Docker Desktop running?
```

This would significantly improve the user experience and reduce confusion.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.