GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feature: auto-detect remote DOCKER_HOST from current docker context · Issue #1025 · testcontainers/testcontainers-python

Feature: auto-detect remote DOCKER_HOST from current docker context #1025

New issue
Copy link
New issue
Copy link
Closed
Enhancement
#1013
#1026
Closed
Feature: auto-detect remote DOCKER_HOST from current docker context#1025
Enhancement
#1013
#1026
Copy link
Assignees
Tranquility2
Labels
🚀 enhancement

Description

@Tranquility2
Tranquility2
opened on May 30, 2026
Issue body actions

Summary

When neither tc.host nor DOCKER_HOST is set, testcontainers-python falls
back to docker-py's default (local unix socket / named pipe). It does not
consult the current docker context.

This is surprising for users who use docker context use <name> to point at a
remote docker daemon (e.g. over SSH or a remote TCP endpoint). The docker
CLI works fine, but testcontainers tries to connect to the local socket and
fails — unless the user manually exports DOCKER_HOST.

For comparison:

  • testcontainers-go already supports this — feat: support reading Docker host from the current Docker context testcontainers-go#2810
  • testcontainers-java has an open enhancement request — [Enhancement]: Support different docker context testcontainers-java#5837

Reproduction

docker context create remote --docker "host=ssh://user@remote-host"
docker context use remote
unset DOCKER_HOST
make tests   # fails: cannot connect to /var/run/docker.sock

Proposal

Add a fallback in get_docker_host() that reads the current docker context's
host (via docker.context.ContextAPI) when no other source is configured,
while leaving the built-in default context to docker-py's normal handling.

Already working on a PR.

Activity

  1. Tranquility2
    self-assigned this
    on May 30, 2026
  2. Tranquility2
    added
    ✨ feat
    on May 30, 2026
  3. Tranquility2
    added the
    Enhancement
    issue type on May 30, 2026
  4. Tranquility2
    added
    🚀 enhancement
    and removed
    ✨ feat
    on May 30, 2026
  5. alexanderankin
    added a commit that references this issue on Jun 2, 2026

    feat(core): auto-detect DOCKER_HOST from current docker context (#1026)

    This issue will close once commit d4b8ff6 is merged into the 'main' branch.
    d4b8ff6
  6. alexanderankin
    closed this as completedin #1026on Jun 2, 2026
  7. alexanderankin
    added a commit that references this issue on Jun 3, 2026

    chore(main): release testcontainers 4.15.0-rc3 (#1013)

    3cbd956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Tranquility2
    Tranquility2

Labels

🚀 enhancement

Type

Enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.