skip to Main Content

I’m trying to setup webdrivermanager java with a chrome browser in a docker container. I have a docker daemon running on my local Windows 10 machine on WSL2. The docker daemon url should be tcp://127.0.0.1:2375.

I have version 5.1.0 of webdrivermanager.

Some sample code

WebDriverManager
        .chromedriver()
        .browserInDocker()
        .dockerDaemonUrl("tcp://127.0.0.1:2375")
        .create();

I always get the following warning: WARN io.github.bonigarcia.wdm.docker.DockerService – Docker is not available in your machine… local browsers are used instead

What is the correct setup for webdrivermanager in this case?

2

Answers


  1. Chosen as BEST ANSWER

    The following attempt was successful. Adding avoidDockerLocalFallback did the trick. The DockerService of WebdriverManager always tries to resolve the docker daemon locally by default but is unsuccessful in case of a docker daemon running on WSL2.

    WebDriverManager
        .chromedriver()
        .browserInDocker()
        .avoidDockerLocalFallback()
        .dockerDaemonUrl("tcp://127.0.0.1:2375")
        .create();
    

  2. For a local Docker engine, the method dockerDaemonUrl() should not be necessary.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search