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 — fix(core): make is_podman respect resolved docker host by Tranquility2 · Pull Request #1048 · testcontainers/testcontainers-python

Conversation

@Tranquility2

@Tranquility2 Tranquility2 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1026 (auto-detect DOCKER_HOST from the current docker context).

Problem

is_podman() used a bare docker.from_env(), which ignores the host resolved by get_docker_host() and never sets use_ssh_client for SSH hosts.

When a remote daemon is configured via a docker context (and DOCKER_HOST is not exported), is_podman() hit the local default socket, failed, and silently returned False. Two consequences:

  • Podman over a docker context was never detected, so Podman-specific normalisation (e.g. in the port tests) was skipped.
  • SSH-based remote daemons could not be queried at all (paramiko also fails under pytest stdin capture, which is why DockerClient passes use_ssh_client=True).

Fix

is_podman() now resolves the host the same way DockerClient does: it builds a client with the resolved base_url (and use_ssh_client=True for ssh://), and only falls back to docker.from_env() when no host is resolved.

Tests

  • Pinned get_docker_host to None in the existing test_is_podman parametrisation so it is deterministic regardless of the docker context configured on the machine running it (it was silently passing only when no context was set).
  • Added test_is_podman_uses_resolved_host covering the resolved-host SSH branch.

Verified manually

Ran tests/core/test_core_ports.py and tests/core/test_docker_client.py against two remote backends over SSH:

Context Backend is_podman() Port tests
remote Podman Podman 5.4 True (was False) 26 passed (was 10 failed)
remote Docker Docker 29.4 False 26 passed

Also simulated the Docker Desktop desktop-linux context from #757: get_docker_host() returns the context socket and is_podman() queries that same socket, returning False as expected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tranquility2 added 2 commits June 6, 2026 21:15
@Tranquility2
fix(core): make is_podman respect resolved docker host
86deeb4
@Tranquility2
Merge branch 'main' into fix/is-podman-respect-docker-context
8b52b7a
@Tranquility2 Tranquility2 self-assigned this Jun 6, 2026
@Tranquility2 Tranquility2 added the 🔧 fix label Jun 6, 2026
@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.95%. Comparing base (a347648) to head (8b52b7a).

Files with missing lines Patch % Lines
src/testcontainers/core/docker_client.py 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1048      +/-   ##
==========================================
- Coverage   85.96%   85.95%   -0.01%     
==========================================
  Files          16       16              
  Lines        1753     1759       +6     
  Branches      196      198       +2     
==========================================
+ Hits         1507     1512       +5     
  Misses        186      186              
- Partials       60       61       +1     
Files with missing lines Coverage Δ
src/testcontainers/core/docker_client.py 92.57% <85.71%> (-0.29%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alexanderankin
alexanderankin approved these changes Jun 10, 2026
View reviewed changes
@alexanderankin
alexanderankin merged commit 6018da3 into main Jun 10, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@alexanderankin
alexanderankin deleted the fix/is-podman-respect-docker-context branch June 10, 2026 23:04
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
chore(main): release testcontainers 4.15.0-rc4 #1046
Merged
alexanderankin added a commit that referenced this pull request Jun 11, 2026
@github-actions @alexanderankin
chore(main): release testcontainers 4.15.0-rc4 (#1046)
c353b17
🤖 I have created a release *beep* *boop*
---


##
[4.15.0-rc4](testcontainers-v4.15.0-rc3...testcontainers-v4.15.0-rc4)
(2026-06-11)


### Features

* extended configuration options for container.exec method
([#1050](#1050))
([7dee471](7dee471))
* **main:** enable typing for complete package
([237be27](237be27))
* **main:** make legacy imports available with deprecation notice
([ab6cca8](ab6cca8))
* **test:** start working on parallel-running tests (WIP!)
([2d24429](2d24429))


### Bug Fixes

* **arangodb:** replace deprecated add_hash_index with
add_persistent_index
([50bb202](50bb202))
* **aws:** wrong path of test
([38089b0](38089b0))
* **ci:** correct coverage paths
([b21eccd](b21eccd))
* **ci:** fix community test selection
([5287fc8](5287fc8))
* **ci:** ignore [@overload](https://github.com/overload) in coverage
([592c6d1](592c6d1))
* **ci:** ignore TYPE_CHECKING block in coverage
([3bdc561](3bdc561))
* **core/registry:** use relative import for _LocalRegistryContainer
([961e3d1](961e3d1))
* **core:** make is_podman respect resolved docker host
([#1048](#1048))
([6018da3](6018da3))
* **docs:** update docs reflecting new structure
([9427055](9427055))
* **doctests:** Ensure paths are correct
([f777673](f777673))
* **k3s:** replace tmpfs dict kwarg with with_tmpfs_mount()
([4d1da0c](4d1da0c))
* **keycloak:** disable SSL requirement for master realm after start
([2a85595](2a85595))
* **main:** adopt ci to new src structure
([dae421d](dae421d))
* **main:** adopt imports to new structure
([9155677](9155677))
* **rabbitmq:** declare queue as durable
([2622736](2622736))
* **ruff:** add **/*_example.py to per-file-ignores for T201
([01dbd16](01dbd16))
* **sftp:** remove redundant start() calls and fix SSH connection
options
([54cef56](54cef56))
* **trino:** increase default startup timeout from 30s to 60s
([2940501](2940501))
* **weaviate:** update and fix module
([5dd2aa1](5dd2aa1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: David Ankin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alexanderankin alexanderankin alexanderankin approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Tranquility2 Tranquility2

Labels

🔧 fix

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Tranquility2 @alexanderankin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.