Skip to content

fix: let the Docker daemon allocate host ports by default - #81

Open
AdzerKI wants to merge 1 commit into
testcontainers:mainfrom
AdzerKI:fix/daemon-allocated-host-ports
Open

AdzerKI wants to merge 1 commit into
testcontainers:mainfrom
AdzerKI:fix/daemon-allocated-host-ports

Conversation

@AdzerKI

@AdzerKI AdzerKI commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #80.

Without a port generator the exposed port binding goes out without HostPort, so the daemon picks a free host port and getMappedPort() reads it from inspect as before. withPortGenerator() still sets the host port it generates.

The new unit test captures the create request and checks the binding for both cases. I also ran the port tests of GenericContainerTest and StartedGenericContainerTest against Podman 4.9.

@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for testcontainers-php ready!

Name Link
🔨 Latest commit 46058b9
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-php/deploys/6adba8a52c6834cc47015f48
😎 Deploy Preview https://deploy-preview-81--testcontainers-php.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client-side host port pick collides with ports already in use

1 participant