Testcontainers-java: 'withNetworkMode()' method is not working for BrowserWebDriverContainer

Created on 25 Dec 2017  路  6Comments  路  Source: testcontainers/testcontainers-java

Hello,
Starting version 1.5.1 'withNetworkMode()' method is not working for BrowserWebDriverContainer.
Here is the gist with failing test:
https://gist.github.com/agafox/5a09659ab20b0c922c91e5307d5dfffd

moduleselenium resolutioacknowledged typbug

All 6 comments

Hi @agafox,

Thanks for reporting! Yes, it is an issue indeed.

May I ask you about your withNetworkMode usecase btw?

Sure @bsideup. I'm using DockerComposeContainer and BrowserWebDriverContainer and looking for the way to land them on the same docker network.

Hi @agafox,

I see. I'll fix it soon-ish, for now you can use a workaround:

browser.withNetwork(
    new Network() {

        @Override
        public Statement apply(Statement base, Description description) {
            return base;
        }

        @Override
        public String getId() {
            return "host";
        }
    }
)

Awesome @bsideup,
Thanks for workaround will try it soon.

Unfortunately the workaround does not work. The error message states:

com.github.dockerjava.api.exception.BadRequestException: {"message":"network-scoped alias is supported only for containers in user defined networks"}
    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:99)
    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:33)
Was this page helpful?
0 / 5 - 0 ratings