Skip to content

Adopt existing LXC containers into pve-compose management #3

@PoBruno

Description

@PoBruno

Right now pve-compose only manages containers it created itself. If you already have LXC containers running Docker Compose stacks, there is no way to bring them under pve-compose control.

On my host I have 17 LXC containers. 10 of them run Docker Compose stacks with bind mounts pointing to app directories on the host. Only 1 has a lxc.json file (the one pve-compose created). The other 9 were set up manually or with scripts, so pve-compose ps, pve-compose doctor, and every other command just fails with "no lxc.json found".

The real data looks like this.

CTID  HOSTNAME       MP0 SOURCE                        MP0 TARGET
117   navidrome      /data/app/navidrome/               /mnt/navidrome
200   immich         /data/app/immich                   /mnt/immich
201   owncloud       /data/app/nextcloud                /mnt/data
203   n8n            /data/app/n8n                      /mnt/n8n
210   gitea          /data/app/gitea                    /mnt/gitea
212   jellyfin       /mnt/pve/storage/app/jellyfin      /mnt/data
241   casa360-prod   /data/app/casa360/prod             /mnt/prod
242   casa360-dev    /data/app/casa360/dev              /mnt/dev

Only speedtest has a lxc.json. The 9 others are invisible to pve-compose.

The idea is to add a command that reads the real container config from /etc/pve/lxc/<ctid>.conf and generates a valid lxc.json from it. After that, all pve-compose commands work normally.

Several edge cases already visible in the data above. CT 201 has hostname owncloud but the directory is called nextcloud. CT 212 uses a completely different storage path. CT 117 has a trailing slash in the mount source. CT 241 and 242 live in nested subdirectories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions