Sharing symlinks between LXC containers?

mattlach

Well-Known Member
Mar 23, 2016
169
17
58
Boston, MA
Hey all,

I'm having a little bit of difficulty getting something to work the way I need it to.

I have two containers. Let's call them LXC1 and LXC2.

LXC1 runs a software that creates files I need to access in LXC2.

LXC1 writes these files to a folder on the host.

The problem is, that the filenames are not human readable. All the human readable file information is stored in a mysql database on LXC1.

In order to solve this issue, the software vendor provides a script that pulls the human readable information from the database, and creates a folder with human readable symlinks to the files generated by the software.

I need to be able to read these symlinks in container LXC2 which has mounted the same data folder as LXC1.

The problem is, the symlinks all wind up being broken links in LXC2 (cannot stat file).

The most obvious way to solve this is to make the directory structure identical on LXC1 and LXC2, but this has proven to be impossible in practice due to my configuration needs.

Does anyone know of any neat little tricks I can use to make a valid symlink inside LXC1 still work inside LXC2 without the directory structure being identical?

Much obliged,
Matt
 
Can you tell the script to create relative symlinks instead? I'm afraid if they're using absolute paths your only choice is to mirror the directory structure one way or another. (This can even be done with symlinks or bind mounts, both of which are somewhat nasty solutions).
But yeah, even relative paths might not match in lxc2.
Alternatively you could write your own script to rewrite the symlinks to lxc2 paths.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!