You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
todo - run tests against docker desktop on linux #621
Because of this, attempting to start fails with the error docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')).
This problem can be solved in ~/.bashrc by setting the environment variable export DOCKER_HOST=unix://${HOME}/.docker/desktop/docker.sock or in ~/.testcontainers.properties by setting tc.host==unix://home/username/.docker/desktop/docker.sock. By the way, TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE environment does not solve the problem.
Then we start to crash with the error docker.errors.APIError: 500 Server Error for http+docker://localhost/v1.51/containers/c57d89b2acb9f9fd4997576bdf62204daacbdfcf01006555cd0cda9e7f3624f7/start: Internal Server Error ("mounts denied: The path /socket_mnt/home/alexelizard/.docker/desktop/docker.sock is not shared from the host and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing. See https://docs.docker.com/ for more info.")
This is an error on startup Ryuk. I couldn't figure out where Ryuk gets the /socket_mnt.
Using export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=${HOME}/.docker/desktop/docker.sock doesn't fix the issue with /socket_mnt.
The solution was found in testcontainers-java #7036 - you need to set the environment variable export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=host.docker.internal.
In summary: to run testcontainers via Docker Desktop in Fedora Workstation, you need to set the following environment variables in ~/.bashrc:
Btw., it's totally ok to explicitly document, that Docker Desktop for Linux is not officially supported by tc-python (we have a similar situation for the other languages, also since having DD4L on CI is very hard).
I'm not sure this is correct. Docker Desktop is quite widely used. Moreover, according to the documentation the Docker host should be detected automatically (item 6), but this doesn't happen.
Activity
[-]todo - run tests against docker desktop on windows[/-][+]todo - run tests against docker desktop on linux[/+]black-snow commentedon Jun 28, 2024
Let me know if I can assist you. Ain't got too much time to spare but I'll do my best ;)
AlexElizard commentedon Oct 6, 2025
My little research.
Introductory:
Let's look at running a basic example from the official website
When DockerContainer is initialized, DockerClient is called, which gets the
docker_hostfrom tc.host in the ~/.testcontainers.properties file or from the DOCKER_HOST environment variable.Because of this, attempting to start fails with the error
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')).This problem can be solved in
~/.bashrcby setting the environment variableexport DOCKER_HOST=unix://${HOME}/.docker/desktop/docker.sockor in~/.testcontainers.propertiesby settingtc.host==unix://home/username/.docker/desktop/docker.sock. By the way,TESTCONTAINERS_DOCKER_SOCKET_OVERRIDEenvironment does not solve the problem.Then we start to crash with the error
docker.errors.APIError: 500 Server Error for http+docker://localhost/v1.51/containers/c57d89b2acb9f9fd4997576bdf62204daacbdfcf01006555cd0cda9e7f3624f7/start: Internal Server Error ("mounts denied: The path /socket_mnt/home/alexelizard/.docker/desktop/docker.sock is not shared from the host and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing. See https://docs.docker.com/ for more info.")This is an error on startup Ryuk. I couldn't figure out where Ryuk gets the
/socket_mnt.Using
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=${HOME}/.docker/desktop/docker.sockdoesn't fix the issue with/socket_mnt.The solution was found in testcontainers-java #7036 - you need to set the environment variable
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=host.docker.internal.In summary: to run testcontainers via Docker Desktop in Fedora Workstation, you need to set the following environment variables in
~/.bashrc:Hope this helps.
kiview commentedon Oct 6, 2025
Btw., it's totally ok to explicitly document, that Docker Desktop for Linux is not officially supported by tc-python (we have a similar situation for the other languages, also since having DD4L on CI is very hard).
AlexElizard commentedon Oct 6, 2025
I'm not sure this is correct. Docker Desktop is quite widely used. Moreover, according to the documentation the Docker host should be detected automatically (item 6), but this doesn't happen.