error during connect: Get "http://remote-host:2375/v1.24/containers/json": EOF
Fixes docker commands failing with 'error during connect ... EOF' when the active docker context points at a dead or unreachable host. Use when docker context ls shows a non-default context in use and every command fails at connect time. Not for default-socket failures or TLS certificate problems.
TL;DR: Your active docker context points at a host that is gone or not listening. Run docker context use default to point the CLI back at the local daemon, or docker context ls to see what is selected. EOF at connect time means something accepted the TCP connection then hung up, which is the classic signature of a stale context.
The error
error during connect: Get "http://remote-host:2375/v1.24/containers/json": EOFFix it
- See which context is active:
docker context ls Expected: an asterisk on something other than default.
- Switch back to the local daemon:
docker context use default Expected: default with Current context is now "default".
- Verify:
docker ps Expected: container list from the local daemon.
- If you actually need the remote host, check it is reachable first:
curl -s http://remote-host:2375/version Expected: a JSON version blob. If it fails, the remote daemon or its firewall is the problem, not your CLI.
When this applies
- You used
docker context useor DOCKER_HOST against a remote/CI host that has since been torn down - Commands fail with EOF or connection refused but the local daemon is fine
When this does NOT apply
- Active context is already
default(local socket problem instead) - Error mentions TLS or certificate verification (TLS config problem, different fix)
- The remote host is up but rejects the API version (client/server version mismatch instead)
Versions
Docker CLI 19.03+, all platforms. The docker context commands exist since 19.03.
Why it happens
docker context use persists the choice in ~/.docker/config.json, so it survives terminal restarts. Weeks later the remote VM is deleted but the CLI still dials it, and a load balancer or dead NAT mapping accepts then drops the connection, producing EOF rather than a clean refused.
Edge cases
- DOCKERHOST env var overrides the context entirely; `echo $DOCKERHOST` if switching contexts changes nothing.
- Remove dead contexts with
docker context rm [name]to stop them shadowing the default. - SSH-based contexts (
docker+ssh://) fail differently (ssh errors); this skill is for tcp contexts.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.