繁体   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