testcontainers / testcontainers/testcontainers-java
[Enhancement]: Throw exception if user tries to set network mode "host"
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 8.7k
- Forks
- 1.9k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 9
Descripción
Module
Core
Proposal
Discussion spawned off of https://github.com/testcontainers/testcontainers-java/issues/5151
As per the docker docs:
The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.
I think we should throw an exception if a user tries to set network mode "host" if they aren't on linux. E.g.
@Override
public SELF withNetworkMode(String networkMode) {
if (networkMode.equals("host") && !SystemUtils.IS_OS_LINUX) {
throw new IllegalArgumentException(
"You are using the 'host' network mode, which is not supported on non-Linux platforms."
);
}
this.networkMode = networkMode;
return self();
}
Our users will experience a lot of weirdness otherwise.
- The container will not be be reachable via any port.
- If a container has any exposed ports, the container won't be able to start up (as we check for the tcp port to open up but it never does in
HostPortWaitStrategy). HttpWaitStrategywon't work
I think we can prevent headache if we did this.
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.
Línea de trabajo
Comienza en el punto de entrada withNetworkMode(String networkMode) del módulo Core y revisa cómo se almacena y utiliza el modo de red. Comprueba el comportamiento existente de HostPortWaitStrategy y HttpWaitStrategy y verifica después que el networking de host no compatible se rechace en plataformas que no sean Linux, mientras que el comportamiento en Linux permanece sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- docker, java
- Área
- networking
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 35/100