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
Hi,
I am starting a Docker-Compose with (in Kotlin):
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.ymlI specify the name of the default network manually (to make sure the name is deterministic with no random strings added to it), ie:I then try to start Chrome with:
However, that does not work. When I use
docker inspecton the Chrome image, the settingfoo-networkis completely ignored, and I get a new network with a random name, eg:Is there a better way to connect
BrowserWebDriverContainerto an existing Docker Compose network? And in any case, if how I usewithNetworkModeis 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