mirror of
https://github.com/moghtech/komodo.git
synced 2026-05-06 17:35:21 -05:00
[GH-ISSUE #87] [Feature] Rootless periphery agent #4663
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @FoxxMD on GitHub (Sep 19, 2024).
Original GitHub issue: https://github.com/moghtech/komodo/issues/87
When a
peripheryagent container creates some resources (repos,stacks) in a bind mount these files are currently created asroot. This makes reading/writing any of these files inconvenient if the user on the host is not root.The container can be run with a non-root user by specify
user: "UID:GID"or equivalent withdocker runand the agent runs fine. It also creates resources with the correct permissions in this instance. However, the agent cannot accessdocker.sockdue to it being owned byroot:dockerwhich is for security, I believe.Please implement a way to allow control over file/folder permissions for resources touched by the agent, or, implement a way to use the container rootless that can still communicate with docker.
Some Thoughts
Enable SSL/HTTP communication with docker
(My preferred solution)
The crate used for docker communication,
bollard, supports SSL/HTTP connections out of the box. The currentconnect_with_local_defaults()function could be try-caught (?) with a fallback toconnect_with_http_defaults()and/orconnect_with_ssl_defaults()-- both of which use environmental variables to initiate a connection which require no config change for the agent.This would enable using docker-socket-proxy for communication which would solve non-root communication with docker.
chownwith UID/GID from ENVAllow a user to specify
UIDandGIDin environmental variables and thenchownfiles touched by the agent. This would allow the agent to continue to work asrootwhile solving file permissions for bind mounts.@mbecker20 commented on GitHub (Oct 17, 2024):
Now supports DOCKER_HOST env variable for use with docker-socket-proxy: https://github.com/mbecker20/komodo/releases/tag/v1.15.10
@paulora2405 commented on GitHub (Mar 20, 2025):
How would one go about configuring
docker-socket-proxyand theDOCKER_HOSTenvvar, in order to enable the usage of a non-root user in the periphery agent?Could you share your config @FoxxMD perhaps?
@FoxxMD commented on GitHub (Mar 20, 2025):
Hi @paulora2405 I wrote a blog post that covers how to do this, some gotchas I discovered, and sample code:
https://blog.foxxmd.dev/posts/migrating-to-komodo/#create-komodo-periphery-agents
Expand the
A Note on Security and Non-Root Peripherysection (andDetailssection within for code example)@willyp713 commented on GitHub (Nov 19, 2025):
@FoxxMD another detail that might be needed (in your blog post or perhaps in the documentation) is that you need to add the rootless path for
docker.sockinto the systemd config for periphery. I had to piece this together from other issues and posts until I figured it out.In
~/.config/systemd/user/periphery.serviceI had to add this line:Note that it required the unix:/// prefix or else the periphery agent would fail with an error about invalid URI scheme.
Another workaround is to create a symlink, such as:
ln -s /run/user/1000/docker.sock /var/run/docker.sockbut that didn't persist after a reboot for me, which is what brought me back here. Adding it to
periphery.serviceseems like a more permanent solution (I think).