testcontainers / testcontainers/testcontainers-java
[Enhancement]: Throw exception if user tries to set network mode "host"
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 8.7k
- Forks
- 1.9k
- Ø Merge
- 2 T. 17 Std.
- Gemergte PRs (30 T.)
- 9
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie beim Einstiegspunkt withNetworkMode(String networkMode) im Core-Modul und prüfen Sie, wie der Netzwerkmodus gespeichert und verwendet wird. Überprüfen Sie das bestehende Verhalten von HostPortWaitStrategy und HttpWaitStrategy und stellen Sie anschließend sicher, dass nicht unterstütztes Host-Networking auf Nicht-Linux-Plattformen abgelehnt wird, während das Linux-Verhalten unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- docker, java
- Bereich
- networking
- Issue-Typ
- Feature
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100