Client-side host port pick collides with ports already in use
評価
調査の方向性
Start with GenericContainer's default host port binding and compare it with the daemon allocated port flow described in the issue. Check how getMappedPort() reads NetworkSettings.Ports, then verify that withPortGenerator() still supports fixed ports. Done means the default binding leaves HostPort unset and the mapped port is available after start; pull request #81 is already open for this change.
索引モデルが issue の本文から書いたものです。
説明
GenericContainer picks host ports on its own: RandomUniquePortGenerator takes a random port from 10000–65535 and only checks that nothing accepts connections on localhost:<port>. The port can still be taken between that check and the container start, or be bound without a listener — for example as the local port of an outgoing connection, when the host's ephemeral range overlaps 10000–65535. The start then fails:
Docker\API\Exception\ContainerStartInternalServerErrorException: server error
rootlessport listen tcp 0.0.0.0:16544: bind: address already in use
We hit this a few times a week on a CI host that runs test suites in parallel (rootless Podman, net.ipv4.ip_local_port_range = 10000 65535).
Other Testcontainers implementations leave host port allocation to the daemon: the binding goes out without HostPort, and the mapped port is read from NetworkSettings.Ports after start. getMappedPort() already reads it from inspect, so only the default binding has to change, while withPortGenerator() keeps working for fixed ports.
I'll open a PR with this change.
- 主要言語
- PHP
- スター
- 216
- フォーク
- 38
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
testcontainers/testcontainers-php のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
testcontainers/testcontainers-php#83 · コメント 3 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
testcontainers/testcontainers-php#57 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
testcontainers/testcontainers-php の issue をすべて見る
似ている issue
-
15.0
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
bug needs-triage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
camunda/orchestration-cluster-api-php#162 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
TYPO3-Solr/ext-solr#4850 ·
メンテナーはふだん 2 日以内に返信
-
Hex viewer drops ASCII '0' after a complete row対応中かも @palashranka が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信