GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — feat(core): auto-detect DOCKER_HOST from current docker context by Tranquility2 · Pull Request #1026 · testcontainers/testcontainers-python Conversation
Contributor
Fall back to the active docker context's host (via docker.context.ContextAPI) when neither tc.host nor DOCKER_HOST is set. Closes #1025
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #1026 +/- ## ========================================== + Coverage 83.06% 83.18% +0.12% ========================================== Files 16 16 Lines 1730 1743 +13 Branches 190 192 +2 ========================================== + Hits 1437 1450 +13 Misses 236 236 Partials 57 57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
🤖 I have created a release *beep* *boop* --- ## [4.15.0-rc3](testcontainers-v4.15.0-rc2...testcontainers-v4.15.0-rc3) (2026-06-03) ### Features * **core:** add Podman compatibility ([#1028](#1028)) ([37093ab](37093ab)) * **core:** auto-detect DOCKER_HOST from current docker context ([#1026](#1026)) ([d4b8ff6](d4b8ff6)), closes [#1025](#1025) ### Bug Fixes * **core:** add container logs to TimeoutError when wait strategy times out ([#1007](#1007)) ([1fadb40](1fadb40)) * **core:** close Reaper socket at interpreter exit to prevent ResourceWarning ([#1017](#1017)) ([d3a1517](d3a1517)) * **cosmosdb:** replace distutils.strtobool removed in Python 3.12 ([#1018](#1018)) ([3e487f4](3e487f4)) * **mongodb:** Use wait strategy instead of deprecated wait_for_logs ([#943](#943)) ([c8118e7](c8118e7)) * **mssql:** use `ExecWaitStrategy` instead of deprecated `wait_container_is_ready` ([#1016](#1016)) ([4c53b89](4c53b89)), closes [#874](#874) * **neo4j:** Swap out use of depricated wait utils for wait_strategies ([#1012](#1012)) ([6deaf3b](6deaf3b)) --- 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]>
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.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Feature: auto-detect remote DOCKER_HOST from current docker context
There was an error while loading. Please reload this page.