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

Support for docker rootless #168

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

jooooscha
Copy link

First, I did not see any contribution guide, therefore I am just opening this PR. I hope that's ok.

Since version 22.05 NixOS has support for rootless docker (manual, docs).
Therefore, I want to add support for it to this great project.

This is currently not working, yet. But I do not know enough about the internals of arion to fix it.
I get some weird docker error; something about certificates (please try it out and see for yourselves).
Also, I am not sure if adding the DOCKER_HOST variable is necessary or if there is a better way (For me the option docker.rootless.setSocketVariable seems to not work)
I am sorry that I cannot be of more help here.

I hope this PR is welcome and is a starting point to bring rootless docker support to this project.

Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool project!
I've made a few comments to help avoid unnecessary incompatibilities when combining configurations.
The general idea is that rootless projects can make choices that are independent of global system level configuration, so that means that we should make more changes at the project level and fewer at the system level.

It should be possible to extend the existing machine in tests/nixos-virtualization-arion-test/test.nix after making some of the changes.

};
in
if cfg.backend == "docker-rootless" then
{ _systemd.user.services."arion-${name}" = service; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. What is your use case for this?
I was expecting a system systemd service that runs entirely as a non-root user.
Both user and system systemd services seem like valid modes; even simultaneously.

Copy link
Author

@jooooscha jooooscha Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, somehow I thought docker and docker-rootless are mutual exclusive. I will change it to support both simultaneously

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, I am a little bit confused. Would you like to start all services as root services?
I think I would start rootless containers as user services, and normal containers as system services.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running a system service as a (system) user with rootless containers is a valid thing to do. It avoids potential confused deputy problems in the docker daemon.

You wouldn't be able to remove as many capabilities from the systemd unit as a non-containerized solution would, but presumably the rootless container runtime still removes those capabilities.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which kind of "deputy problems" do you mean?

I rather think this could create problems on multi-user setups, because the DOCKER_HOST socket is individual to every user.

But don't get me wrong; it certainly is your thing to decide.

nixos-module.nix Outdated Show resolved Hide resolved
nixos-module.nix Outdated Show resolved Hide resolved
nixos-module.nix Outdated Show resolved Hide resolved
nixos-module.nix Outdated Show resolved Hide resolved
Co-authored-by: Robert Hensing <[email protected]>
@jooooscha

This comment was marked as resolved.

@jooooscha

This comment was marked as resolved.

@nikp123
Copy link

nikp123 commented Feb 21, 2024

Is there any chance this gets merged? I'd love for rootless docker to be a thing in arion.

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

Successfully merging this pull request may close these issues.

3 participants