Correct practice for migrating data, user accounts and permissions from LXC to Docker

Hello there.

We’re moving from a traditionally set up Nextcloud running in an LXC container to a Docker container built from docker-compose which is sat behind Traefik.

We’ve got loads of unused and unwanted apps in our LXC Nextcloud and the logs are rife with all sorts of issues (mostly relating to the extensions), so I’d like to start afresh and migrate only user accounts, groups and the filestore with its permissions intact (if possible).

The Docker instance is set up and works perfectly and now has the domain pointing to it. The files were copied using SCP to the named volume that’s attached to Docker container and the folder structure all looks as it did on the LXC instance. I’m aware that I need to invoke a scan using OCC, and I’ve checked and tested the method for doing so using Docker – all seems good.

Before I do that, I obviously need the user data and permissions from the old instance otherwise there’s nothing to index against. Everything I’ve read online seems to suggest a database migration which in principle I’m fine with, but I want to know what data is contained in the database before doing so as I am only interested in replicating users, groups and permissions. If the DB contains data related to extensions, email or any other gubbins then it’s likely to be orphaned and maybe cause problems.

What’s the best practice here? Should I import specific tables from the DB? Is it safe to import the whole DB? Should I just manually create the user accounts again and start afresh with permissions and sharing (undesirable but we’re not talking about a lot of users, files or shares).

Any help is appreciated!


I didn’t see a DB schema documentation so far, so selective migration of the stuff you want seems pretty hard. I would suggest you perform a DB migration but remove all the apps in advance - this may be enough to meet your goal. after successful migration you may still try to clean up the DB. docker is really powerful in terms of add/move/change your DB and application so you can postpone problematic tasks until you find you have to mess with the DB cleanup.

hiya. Cheers for input.

I ended up setting each user account up one-by-one, then copied each user’s files from the old server into their new user directories under the data dir. Everyone’s got new passwords but all of the shares and permissions seem to be intact. It’s working really well and I was able to avoid moving over anything more than was actually required.


1 Like