Best way to share a unix socket?


#1

I’ve setup a postgresql database with lxc/ext4. What’s the best way to share the unix socket across other containers? My current idea is to create a host folder and share it between the guests (via lxc.mount.entry bind).
Would this be a wise choice or is there a better way?


#2

Hi!

If you where using LXD, you would create a proxy device (Unix <-> Unix) according to https://github.com/lxc/lxd/blob/master/doc/containers.md#type-proxy
You would also specify the proxy UID/GID on the host and also on the container(s).
The equivalent with plain LXC would be to use a tool like “socat”.

The mounting that you are considering in plain LXC is equivalent to the LXD “disk” device.


#3

“socat” is nice indeed. Allows proper uids/gids for unprivileged guests.
Will test some scenarios to see if the socat bridge remains stable upon database outages.

Thanks!

LXD custom patches pop up now and then for OpenWrt but looks like no one actually brings it upstream.