Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error when using Docker 4.13.0 - Missing symlink it seems #6076

Closed
HelloThisIsFlo opened this issue Oct 28, 2022 · 2 comments
Closed
Labels

Comments

@HelloThisIsFlo
Copy link

HelloThisIsFlo commented Oct 28, 2022

Module

MySQL

Testcontainers version

1.15.3

Using the latest Testcontainers version?

No

Host OS

Mac OS

Host Arch

x86

Docker version

Client:
 Cloud integration: v1.0.29
 Version:           20.10.20
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        9fdeb9c
 Built:             Tue Oct 18 18:20:35 2022
 OS/Arch:           darwin/amd64
 Context:           desktop-linux
 Experimental:      true

Server: Docker Desktop 4.13.0 (89412)
 Engine:
  Version:          20.10.20
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       03df974
  Built:            Tue Oct 18 18:18:35 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

When trying to run a test with testcontainer, there's an error: Could not find a valid Docker environment

After spending a long time trying to debug the issue we found out that it's because Docker doesn't create a docker.sock at /var/run by default anymore. That behaviour is since 4.13.0 and is documented in the release notes

We were able to fix the problem by manually creating a symlink: sudo ln -s $HOME/.docker/run/docker-cli.sock /var/run/docker-cli.sock

I'm opening this issue to bring awareness to the problem. You could

  1. Update the documentation, and the error message, to inform people this symlink is now needed
  2. Point UnixSocketClientProviderStrategy to the new location of the socket ($HOME/.docker/run)
  3. Do anything else 😁

I hope that's helpful, if not feel free to close 👍

Best,
Flo

Note: I could not update the version of test-containers (working on a client project), but I don't think it's version related as it's still present in the current main. If I'm mistaken and the bug has been fixed already, sorry for the false alert 🙂

Relevant log output

Could not find a valid Docker environment. Please see logs and check configuration
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:215)
	at java.util.Optional.orElseThrow(Optional.java:290)
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:207)
	at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:136)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:178)
	at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
	at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
	...

Additional Information

No response

@eddumelendez
Copy link
Member

Hi @FlorianKempenich! We updated our docs properly, you can see it here. We also had a discussion and was properly answered. Also, looks like the change is going to be back to Docker Desktop, see comment.

@HelloThisIsFlo
Copy link
Author

Great! Thanks for the update 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants