testcontainers / testcontainers/testcontainers-java
BrowserWebDriverContainer#withNetworkMode does not seem to work
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 8.7k
- Fork
- 1.9k
- Merge medio
- 2g 17h
- PR unite (30g)
- 9
Descrizione
Hi,
I am starting a Docker-Compose with (in Kotlin):
@ClassRule
@JvmField
val env: DockerComposeContainer =
DockerComposeContainer(composeId, File("../docker-compose.yml"))
.withLocalCompose(true)
this works just fine. However, I want to add a Chrome Docker image to control with TestContainer, which should be on the same network of Docker Compose. In docker-compose.yml I specify the name of the default network manually (to make sure the name is deterministic with no random strings added to it), ie:
networks:
default:
name: foo-network
I then try to start Chrome with:
@Rule
@JvmField
val browser: BrowserWebDriverContainer = BrowserWebDriverContainer()
.withDesiredCapabilities(DesiredCapabilities.chrome())
.withNetworkMode("foo-network")
However, that does not work. When I use docker inspect on the Chrome image, the setting foo-network is completely ignored, and I get a new network with a random name, eg:
"Networks": {
"7af40cfa-f262-463c-accb-1707bdd8f2d9": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"tc-qEF38kvs",
"a8bd32b1f2f3"
],
"NetworkID": "96313abc29bedbb992f754ba6684a3c8847bcd7f8bf9af547ce6fb38b0152a91",
"EndpointID": "6851d5ba06dda964677f57263a03806c47aea7d3a021fb2e71b3f14fe895664f",
"Gateway": "192.168.48.1",
"IPAddress": "192.168.48.2",
"IPPrefixLen": 20,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:c0:a8:30:02",
"DriverOpts": null
}
}
Is there a better way to connect BrowserWebDriverContainer to an existing Docker Compose network? And in any case, if how I use withNetworkMode is wrong, it would be good if TestContainer threw an exception with some info.
TestContainer version: 1.9.1
Docker version: 18.06.1
OS: Mac 10.12.6
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 da BrowserWebDriverContainer#withNetworkMode e DockerComposeContainer, riproducendo la dichiarazione di rete fornita in docker-compose.yml e ispezionando le reti del container creato. Il lavoro è completato quando viene determinato perché foo-network viene ignorato e viene stabilito il comportamento di connessione supportato, incluso un errore informativo se la modalità non è valida.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, docker-compose, java, kotlin
- Ambito
- networking, testing
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100