Client-side host port pick collides with ports already in use
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 20/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- PHP
- Estrellas
- 216
- Forks
- 38
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de testcontainers/testcontainers-php
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
testcontainers/testcontainers-php#83 · 3 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
testcontainers/testcontainers-php#57 · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
-
WaitForLog timeout too shortAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
Todos los issues de testcontainers/testcontainers-php
Issues similares
-
15.0
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
bug needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
camunda/orchestration-cluster-api-php#162 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Procedure for security issuesAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
TYPO3-Solr/ext-solr#4850 ·
Los mantenedores suelen responder en 2 días
-
Hex viewer drops ASCII '0' after a complete rowPosiblemente ocupada @palashranka la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días