-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Enhancement]: Support Docker desktop on Linux #6426
Comments
I have never tried out using Testcontainers with Docker Desktop on Linux. Can you please share the logs of the Ryuk container that failed to start? Does it work if you disable Ryuk? |
I've the same issue, overriding docker.host in .testcontainers.properties docker.host=unix:///home/USER/.docker/desktop/docker.sock does not work |
I have a Linux PC so let me try investigating this... |
@sergeda @folofsson have you been able to resolve this? if not, could you please provide a full log? and also the results of
As a temporary workaround, you can create a symlink like this:
I was able to run a test successfully this way. |
@kiview Docker Desktop for Linux creates a socket in /home/$USER/.docker/desktop/docker.sock and neither EnvironmentAndSystemPropertyClientProviderStrategy nor UnixSocketClientProviderStrategy is able to handle this at the moment. Should I raise a PR to fix this? I wonder why nobody has reported this until now, DD for Linux has been available since last May. |
Ok, I hit a dead end. I tried adding the following to the .testcontainers.properties - With that mount the ryuk container fails to start with the following error:
However when I do The workaround remains:
This is a brittle solution however since /var/run must be cleaned up on every restart and besides making this symlink requires Docker Desktop to be running so I'm not even sure that you can run this workaround on start-up. |
For me when I try to do
|
I ran into the same issue when using docker desktop on linux. I have used podman for quite a while and switched back to docker. Due to podman i was already familiar with "disabling ryuk". I got testcontainers to work with docker desktop by doing this
then that
Proof:
|
Docker Desktop for Linux installs the socket path at `/home/username/.docker/desktop/docker.sock`. In Docker Desktop for Mac 4.18, there is an option to disable the default Docker socket (/var/run/docker.sock) and rely on `/home/username/.docker/run/docker.sock` instead. Fixes #6426
Docker Desktop for Linux installs the socket path at `/home/username/.docker/desktop/docker.sock`. In Docker Desktop for Mac 4.18, there is an option to disable the default Docker socket (/var/run/docker.sock) and rely on `/home/username/.docker/run/docker.sock` instead. Fixes #6426
When working on this for Docker for Mac, we realized this line https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/utility/RyukContainer.java#L23 should be /var/run/docker.sock instead of the rootless path. Wonder if that the same for DD for Linux. I guess so. I need some help here :) I've failed setting up DD for Linux in a VM. |
As an in-between summary: TestContainers v1.18.1 out-of-the-box does not work with vanilla Docker Desktop for Linux v4.19.0 (checked on Ubuntu 23.04) failing with:
The reason is the same difference between Docker Engine and Docker Desktop.
However, none of them looks scalable for the whole development team with similar local environments. Maybe a naive suggestion, but what if TestContainers as a last resort could look into current machine's Docker CLI config and pick the Docker endpoint from there:
? |
The correct configuration (for Docker Desktop running rootless) is:
Testcontainers extracts the socket path from the Docker host configuration (e.g. from the |
Module
Core
Proposal
Currently, when I try to run Testcontainers on Linux with Docker desktop installed I get this error:
The text was updated successfully, but these errors were encountered: