簡體   English   中英

TestContainers 框架無法訪問 docker deamon

[英]TestContainers Framework can't reach docker deamon

我正在嘗試讓testcontainers構建一個 mariadb 實例,如下所示:

connection = DriverManager.getConnection("jdbc:tc:mariadb:5.6.23:///datavault");

但我得到的是這個日志:

01:03:00.438 [main] DEBUG o.t.jdbc.ContainerDatabaseDriver - Container not found in cache, creating new instance
01:03:00.540 [main] DEBUG o.t.u.TestcontainersConfiguration - Testcontainers configuration overrides will be loaded from file:/home/tobias/.testcontainers.properties
01:03:00.545 [main] INFO  o.t.utility.ImageNameSubstitutor - Image name substitution will be performed by: DefaultImageNameSubstitutor (ConfigurationFileImageNameSubstitutor)
01:03:00.559 [main] DEBUG o.t.utility.ImageNameSubstitutor - Did not find a substitute image for mariadb:5.6.23 (using image substitutor: DefaultImageNameSubstitutor (ConfigurationFileImageNameSubstitutor))
01:03:00.612 [main] INFO  o.t.d.DockerMachineClientProviderStrategy - docker-machine executable was not found on PATH ([/usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, /usr/games, /usr/local/games, /snap/bin])
01:03:00.612 [main] DEBUG o.t.d.RootlessDockerClientProviderStrategy - $XDG_RUNTIME_DIR is set but '/run/user/1000/snap.intellij-idea-community/docker.sock' does not exist.
01:03:00.613 [main] DEBUG o.t.d.RootlessDockerClientProviderStrategy - '/home/tobias/.docker/run' does not exist.
01:03:00.708 [main] DEBUG o.t.d.RootlessDockerClientProviderStrategy - '/run/user/1000/docker.sock' does not exist.
01:03:01.277 [ducttape-0] DEBUG o.t.d.DockerClientProviderStrategy - Pinging docker daemon...
01:03:01.299 [ducttape-0] DEBUG o.t.s.c.g.d.c.command.AbstrDockerCmd - Cmd: 
01:03:01.428 [ducttape-0] DEBUG o.t.d.DockerClientProviderStrategy - Pinging docker daemon...
01:03:01.428 [ducttape-0] DEBUG o.t.s.c.g.d.c.command.AbstrDockerCmd - Cmd: 
01:03:01.530 [ducttape-0] DEBUG o.t.d.DockerClientProviderStrategy - Pinging docker daemon...
01:03:01.530 [ducttape-0] DEBUG o.t.s.c.g.d.c.command.AbstrDockerCmd - Cmd: 
01:03:01.633 [ducttape-0] DEBUG o.t.d.DockerClientProviderStrategy - Pinging docker daemon...
01:03:01.633 [ducttape-0] DEBUG o.t.s.c.g.d.c.command.AbstrDockerCmd - Cmd:
...

我正在使用docker it self 提供的 ubuntu 存儲庫中默認 docker 安裝
假設 testcontainers 無法讀取 /var/run/docker.sock 文件,
我將我的用戶添加到docker組,但錯誤是一樣的!

另外我嘗試了 快速入門示例,但仍然出現相同的錯誤!

非常感謝您的幫助,
如果您需要更多信息,請告訴我!

有時它可以如此簡單:
添加到 docker 組是正確的想法
但我忘記了添加到組的事實
僅在新登錄用戶后接管!

23:18:04.457 [ducttape-0] DEBUG o.t.d.DockerClientProviderStrategy - Pinging docker daemon...
23:18:04.483 [ducttape-0] DEBUG o.t.s.c.g.d.c.command.AbstrDockerCmd - Cmd: 
23:18:04.720 [main] INFO  o.t.d.DockerClientProviderStrategy - Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
23:18:04.721 [main] DEBUG o.t.d.DockerClientProviderStrategy - Transport type: 'okhttp', Docker host: 'unix:///var/run/docker.sock'
23:18:04.721 [main] DEBUG o.t.d.DockerClientProviderStrategy - Checking Docker OS type for local Unix socket (unix:///var/run/docker.sock)
23:18:04.722 [main] INFO  o.testcontainers.DockerClientFactory - Docker host IP address is localhost
23:18:04.723 [main] DEBUG o.t.s.c.g.d.c.command.AbstrDockerCmd - Cmd: 
23:18:04.742 [main] DEBUG o.t.s.c.g.d.c.command.AbstrDockerCmd - Cmd: 
23:18:04.757 [main] INFO  o.testcontainers.DockerClientFactory - Connected to docker: 
  Server Version: 19.03.13
  API Version: 1.40
  Operating System: Ubuntu 18.04.5 LTS
  Total Memory: 7894 MB

之后,我收到一個新錯誤,但這是另一個主題。
抱歉打擾了!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM