webdrivermanager icon indicating copy to clipboard operation
webdrivermanager copied to clipboard

Docker Image Pull Issue since 22nd of Feb

Open furkanyy opened this issue 11 months ago • 5 comments

Starting from the 22nd of Feb, our tests have stopped working. The issue seems to be the failure to pull Docker images. There have been no changes in our code during those dates. It is working neither in the VM we use on GCP nor in our local. Docker installation and docker connectivity are ok on my local. I'm able to pull images from the docker hub. However, the docker images cannot be pulled successfully by webdrivermanager.

Versions in pom.xml file we use are quite similar to the example file in this repository:

 <properties>
        <slf4j.version>2.0.12</slf4j.version>
        <logback.version>1.5.0</logback.version>
        <selenium.version>4.18.1</selenium.version>
        <wdm.version>5.7.0</wdm.version>
        <testng.version>7.9.0</testng.version>
        <cucumber.version>7.11.1</cucumber.version>
        <cucumber.core.version>7.11.1</cucumber.core.version>
        <info.cukes.version>1.2.6</info.cukes.version>
        <firebase.admin.version>9.0.0</firebase.admin.version>
        <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>11</java.version>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.argument.target>${maven.compiler.target}</maven.compiler.argument.target>
        <maven.compiler.argument.source>${maven.compiler.source}</maven.compiler.argument.source>
    </properties>

Selenium version: 4.18.1

WebDriverManager version: 5.7.0

WebDriverManager call:

ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("--remote-allow-origins=*");
        chromeOptions.addArguments("--no-sandbox");

        WebDriverManager wdm = WebDriverManager.chromedriver().capabilities(chromeOptions).browserInDocker().enableVnc().enableRecording();
        driver = wdm.create(); // wdm in docker

WebDriverManager traces:

Connected to the target VM, address: '127.0.0.1:55846', transport: 'socket'
2024-02-26 20:48:37 [main] DEBUG i.g.bonigarcia.wdm.WebDriverManager.<init>(226) - Using WebDriverManager 5.7.0
2024-02-26 20:48:47 [main] DEBUG i.g.b.wdm.docker.DockerHubService.listTags(60) - Getting browser image list from Docker Hub
2024-02-26 20:48:47 [main] TRACE i.g.b.wdm.docker.DockerHubService.listTags(73) - Sending request to https://hub.docker.com/v2/repositories/selenoid/vnc/tags?page=1&page_size=1024
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerHubService.listTags(73) - Sending request to https://hub.docker.com/v2/repositories/selenoid/vnc/tags?page=2&page_size=100
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerHubService.listTags(73) - Sending request to https://hub.docker.com/v2/repositories/selenoid/vnc/tags?page=3&page_size=100
2024-02-26 20:48:48 [main] DEBUG i.g.b.wdm.docker.DockerService.getImageVersionFromDockerHub(477) - The latest version of Chrome in Docker Hub is 121.0
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.getDockerImage(523) - Docker image: selenoid/vnc:chrome_121.0
2024-02-26 20:48:48 [main] INFO  i.g.b.wdm.docker.DockerService.pullImageIfNecessary(336) - Pulling Docker image selenoid/vnc:chrome_121.0 (this might take some time, but only the first time)

The error message java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory seems that WebDriverManager is encountering an issue related to file or directory access during its Docker operations

Error log:

2024-02-26 20:48:48 [docker-java-stream--1280939933] ERROR c.g.d.a.async.ResultCallbackTemplate.onError(52) - Error during callback
java.lang.RuntimeException: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:195)
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
	at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
	at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
	at com.github.dockerjava.transport.DomainSocket.<init>(DomainSocket.java:63)
	at com.github.dockerjava.transport.BsdDomainSocket.<init>(BsdDomainSocket.java:43)
	at com.github.dockerjava.transport.DomainSocket.get(DomainSocket.java:138)
	at com.github.dockerjava.transport.UnixSocket.get(UnixSocket.java:29)
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl$2.createSocket(ApacheDockerHttpClientImpl.java:153)
	at org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:155)
	at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:447)
	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:162)
	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:172)
	at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:142)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:96)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:115)
	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
	at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
	at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:87)
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:191)
	... 4 common frames omitted
Caused by: com.sun.jna.LastErrorException: [2] No such file or directory
	at com.github.dockerjava.transport.BsdDomainSocket.connect(Native Method)
	at com.github.dockerjava.transport.BsdDomainSocket.connect(BsdDomainSocket.java:49)
	at com.github.dockerjava.transport.DomainSocket.open(DomainSocket.java:69)
	at com.github.dockerjava.transport.DomainSocket.<init>(DomainSocket.java:59)
	... 25 common frames omitted
2024-02-26 20:48:48 [main] WARN  i.g.b.wdm.docker.DockerService.pullImageIfNecessary(349) - Exception pulling image selenoid/vnc:chrome_121.0: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
2024-02-26 20:48:48 [main] TRACE i.g.bonigarcia.wdm.config.Config.getDockerMemSizeBytes(1107) - The memory size 256m is equivalent to 268435456 bytes)
2024-02-26 20:48:48 [main] TRACE i.g.bonigarcia.wdm.config.Config.getDockerMemSizeBytes(1107) - The memory size 128m is equivalent to 134217728 bytes)
2024-02-26 20:48:48 [main] INFO  i.g.b.wdm.docker.DockerService.startContainer(183) - Starting Docker container selenoid/vnc:chrome_121.0
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.startContainer(196) - Adding sysadmin capability
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.startContainer(202) - Using shm size: 268435456
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.startContainer(208) - Using network: bridge
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.startContainer(213) - Using exposed ports: [4444, 5900]
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.startContainer(222) - Using binds: []
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.startContainer(228) - Using mounts: [Mount(type=TMPFS, source=null, target=/tmp, readOnly=null, bindOptions=null, volumeOptions=null, tmpfsOptions=TmpfsOptions(sizeBytes=134217728, mode=null))]
2024-02-26 20:48:48 [main] TRACE i.g.b.wdm.docker.DockerService.startContainer(234) - Using envs: [TZ=Etc/UTC, LANGUAGE=EN, SCREEN_RESOLUTION=1280x1080x24, ENABLE_VNC=true, DRIVER_ARGS=--whitelisted-ips= --allowed-origins=*]

I got the same issues for Firefox configuration:

2024-02-29 15:47:20 [main] TRACE i.g.b.wdm.docker.DockerService.getDockerImage(523) - Docker image: selenoid/vnc:firefox_123.0
2024-02-29 15:47:20 [main] INFO  i.g.b.wdm.docker.DockerService.pullImageIfNecessary(336) - Pulling Docker image selenoid/vnc:firefox_123.0 (this might take some time, but only the first time)
2024-02-29 15:47:21 [docker-java-stream-1020319870] ERROR c.g.d.a.async.ResultCallbackTemplate.onError(52) - Error during callback
java.lang.RuntimeException: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:195)
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
	at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
	at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory

furkanyy avatar Feb 26 '24 18:02 furkanyy

Is this issues still happening?

bonigarcia avatar Mar 10 '24 16:03 bonigarcia

Yes, it is still happening @bonigarcia

furkanyy avatar Mar 10 '24 16:03 furkanyy

I am not able to reproduce your issue. I have just executed this test:

class DockerChromeJupiterTest {

    WebDriver driver;

    WebDriverManager wdm;

    @BeforeEach
    void setupTest() {
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("--remote-allow-origins=*");
        chromeOptions.addArguments("--no-sandbox");

        wdm = WebDriverManager.chromedriver().capabilities(chromeOptions)
                .browserInDocker().enableVnc().enableRecording();
        driver = wdm.create();
    }

    @AfterEach
    void teardown() {
        wdm.quit();
    }

    @Test
    void testDockerChrome() {
        driver.get("https://bonigarcia.dev/selenium-webdriver-java/");
        assertThat(driver.getTitle()).contains("Selenium WebDriver");
    }

}

And it works as expected:

2024-03-10 17:29:49 [ForkJoinPool-1-worker-1] DEBUG i.g.bonigarcia.wdm.WebDriverManager.<init>(226) - Using WebDriverManager 5.7.0
2024-03-10 17:29:50 [ForkJoinPool-1-worker-1] DEBUG i.g.b.wdm.cache.ResolutionCache.checkKeyInResolutionCache(186) - Resolution chrome-container-latest=122.0 in cache (valid until 18:29:31 10/03/2024 CET)
2024-03-10 17:29:50 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.startContainer(183) - Starting Docker container selenoid/vnc:chrome_122.0
2024-03-10 17:29:51 [ForkJoinPool-1-worker-1] DEBUG i.g.b.wdm.docker.DockerService.startBrowserContainer(700) - VNC server URL: vnc://localhost:32769/
2024-03-10 17:29:51 [ForkJoinPool-1-worker-1] DEBUG i.g.b.wdm.webdriver.WebDriverCreator.createRemoteWebDriver(77) - Creating WebDriver object for chrome at http://localhost:32770/ with Capabilities {browserName: chrome, goog:chromeOptions: {args: [--disable-gpu, --remote-allow-origins=*, --no-sandbox], extensions: []}}
Mar 10, 2024 5:29:52 PM org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer createTracer
INFO: Using OpenTelemetry for tracing
2024-03-10 17:29:52 [ForkJoinPool-1-worker-1] DEBUG i.g.b.wdm.webdriver.WebDriverCreator.getSessionId(120) - The sessionId is 1ca0a2ad4992ded5190bd7a5e7ae9123
2024-03-10 17:29:52 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.pullImageIfNecessary(336) - Pulling Docker image bonigarcia/novnc:1.1.0 (this might take some time, but only the first time)
2024-03-10 17:29:54 [ForkJoinPool-1-worker-1] DEBUG i.g.b.wdm.cache.ResolutionCache.putValueInResolutionCacheIfEmpty(119) - Storing resolution novnc-container=1.1.0 in cache (valid until 18:29:54 10/03/2024 CET)
2024-03-10 17:29:54 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.startContainer(183) - Starting Docker container bonigarcia/novnc:1.1.0
2024-03-10 17:29:54 [ForkJoinPool-1-worker-1] INFO  i.g.bonigarcia.wdm.WebDriverManager.createDockerWebDriver(1908) - Docker session noVNC URL: http://localhost:32771/
2024-03-10 17:29:54 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.pullImageIfNecessary(336) - Pulling Docker image selenoid/video-recorder:7.1 (this might take some time, but only the first time)
2024-03-10 17:29:58 [ForkJoinPool-1-worker-1] DEBUG i.g.b.wdm.cache.ResolutionCache.putValueInResolutionCacheIfEmpty(119) - Storing resolution recorder-container=7.1 in cache (valid until 18:29:58 10/03/2024 CET)
2024-03-10 17:29:58 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.startContainer(183) - Starting Docker container selenoid/video-recorder:7.1
2024-03-10 17:29:59 [ForkJoinPool-1-worker-1] INFO  i.g.bonigarcia.wdm.WebDriverManager.createDockerWebDriver(1922) - Starting recording ./chrome_2024.03.10_17.29.58.931_1ca0a2ad4992ded5190bd7a5e7ae9123.mp4
2024-03-10 17:29:59 [ForkJoinPool-1-worker-1] DEBUG i.g.bonigarcia.wdm.WebDriverManager.quit(950) - Quitting RemoteWebDriver: chrome on linux (1ca0a2ad4992ded5190bd7a5e7ae9123)
2024-03-10 17:29:59 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.stopAndRemoveContainer(360) - Stopping Docker container selenoid/video-recorder:7.1
2024-03-10 17:30:01 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.stopAndRemoveContainer(360) - Stopping Docker container selenoid/vnc:chrome_122.0
2024-03-10 17:30:01 [ForkJoinPool-1-worker-1] INFO  i.g.b.wdm.docker.DockerService.stopAndRemoveContainer(360) - Stopping Docker container bonigarcia/novnc:1.1.0

bonigarcia avatar Mar 10 '24 16:03 bonigarcia

Interestingly, I've been still getting this issue in one of my setups (not all) and investigating it to provide more information

furkanyy avatar Mar 19 '24 10:03 furkanyy

I think i've reproduce the behavior but did not figure it out why

edumco@Eduardo:~$ sudo **docker** pull selenoid/vnc:chrome_121.0
chrome_121.0: Pulling from selenoid/vnc
29202e855b20: Pull complete
8bbed5a5e228: Pull complete
938c53ffb1bd: Pull complete
6a9f3327f0e6: Pull complete
...

edumco@Eduardo:~$ sudo **podman** image pull selenoid/vnc:chrome_121.0
Error: short-name "selenoid/vnc:chrome_121.0" did not resolve to an alias and no unqualified-search registries are defined in 
"/etc/containers/registries.conf"`

edumco avatar Mar 20 '24 02:03 edumco