testcontainers / testcontainers/testcontainers-java
[Enhancement]: Throw exception if user tries to set network mode "host"
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 8.7k
- Fork
- 1.9k
- Merge medio
- 2g 17h
- PR unite (30g)
- 9
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dal punto di ingresso withNetworkMode(String networkMode) nel modulo Core e verifica come viene memorizzata e utilizzata la modalità di rete. Controlla il comportamento esistente di HostPortWaitStrategy e HttpWaitStrategy, quindi verifica che l’host networking non supportato venga rifiutato sulle piattaforme non Linux, mentre il comportamento su Linux rimanga invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, java
- Ambito
- networking
- Tipo di issue
- Funzionalità
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100