VirtCode / serene-aur

replace your aur helper with a self-hosted build server
MIT License
5 stars 1 forks source link

Support for specifying a custom docker connection URI #2

Closed mariuszste closed 1 month ago

mariuszste commented 1 month ago

It would be nice if we could specify a custom docker socket to use via env variables with support for more than just unix sockets (like TCP). Would replacing Docker::connect_with_socket_defaults with Docker::connect_with_defaults be enough or am I missing something? I've looked at the code and it doesn't seem to do anything hacky so I don't see why this couldn't work.

VirtCode commented 1 month ago

Yes, replacing that with any other connect_with method should just work, as all interfacing with the containers is done through this Docker instance. It would be nice if we could specify an url in the config (i.e. with tcp:// or unix://) which would then be used. I might have a look at this later this week.

As for docker in docker, I think it's a really cool concept, but am unsure about it (see this blogpost). But if we can specify an url like above, we can easily create a second image which makes use of docker in docker.

mariuszste commented 1 month ago

yeah, I know that DinD has some nasty downsides, maybe I shouldn't have mentioned it. IMO adding support for connecting to different docker sockets should be the only concern. If someone crazy like me wants to run DinD it should be their problem, supporting it officially will just put unnecessary maintenance costs on you.

we can easily create a second image which makes use of docker in docker.

What? Why would we need another image? What for? Docker already provides official dind images (library/docker:dind), if a user wants to they can just run that themselves and provide the URL to connect to it. The existing runner containers shouldn't care where they are running since as you mentioned "all interfacing with the containers is done through this Docker instance"

VirtCode commented 1 month ago

I've just added support for custom docker urls (in https://github.com/VirtCode/serene-aur/commit/be8e04c1419576e07e68bd1fd15361795f8f74ae) with the DOCKER_URL environment variable. I've tested it with docker on my local host, and it seems to work with both tcp and unix sockets.

What? Why would we need another image? What for?

Sorry, I was thinking a bit too far ahead already. I thought one could base another image off of the official docker one, to ship the server and the DinD in the same container, making it easy to deploy. But yeah, I probably won't support DinD "officially".

However, let me know how DinD goes with this project on your end, I am really interested how well it works and might consider also doing DinD where I host it. Maybe I can also add a small note or hint to the documentation for "advanced users" because I also find it a bit suboptimal that you have to mount the host docker socket into the container.

mariuszste commented 1 month ago

works, thank you