-
Notifications
You must be signed in to change notification settings - Fork 296
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: RYUK container startup failure when running Docker in rootless mode #537
Comments
can you confirm this approach:
|
and then i guess we will need to tweak the Reaper class a bit in |
This returns the following: $ python detect_rootless.py
True |
I also use rootless Docker and I can confirm this issue. |
Would it be possible to fix this so that
Nowadays any dev slightly conscious should be using rootless docker (because it is safer, and because it reduce friction with file ownerships when mounting volumes inside an image that use the root user. So not only it is safer, but it is also easier to use...). It's a bit the future of containers, but it's already there and working. So |
you can import the config module and set it on the dataclass there
|
Ah, we have confirmed that the logic i provided above works. Then all that remains is plugging it in I suppose. I'll accept PR that fixes the issue. yes. |
I am not forced to use docker rootless neither, it's just that it's better than the root option, especially when you use containers a lot for development, try it you'll see :) Rootless docker can be easily enabled following these docs: https://docs.docker.com/engine/security/rootless/ usually 3 commands: dockerd-rootless-setuptool.sh install
systemctl --user enable docker
loginctl enable-linger $UID Unfortunately I just realized that But An easy solution would be to just change the default I might look into this if I find sometimes and will send a PR |
…s docker (required to run ryuk). Fixes testcontainers#537
Describe the bug
When Docker is run in rootless mode, the
ryuk
fails to start as the docker socket mounted as a volume has the wrong permissions (nobody:nobody
). This can be fixed be mounting the correct socket at/run/user/$(id -u)/docker.sock
.The overwrite can be done by setting the environment variable
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE
to the above mentioned socket.Ideally, this would be detected and configured automatically (ie. using
Server.Security Options.rootless
andEndpoints.docker.Host
of the active context or theDOCKER_HOST
environment variable).If this is not an option, please consider documenting this case more in detail.
To Reproduce
Configure Docker to run in rootless mode (see https://docs.docker.com/engine/security/rootless/) and run the following snippet:
Runtime environment
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of
testcontainers-python
you are using? You can run the following commands to get the relevant information.The text was updated successfully, but these errors were encountered: