I feel kinda stupid about this problem, I am quite the newbie when it comes to docker, but here is the situation:
I am running ubuntu server 22.04 and the docker snap. I wanted to have the nextlcoud save-data on a separate harddrive on my server, and because there seemed to be no real elegant way to go about this when using the nextcloud docker-aio setup, I just bind-mounted the entire /var/snap/docker directory to a directory on my separate harddrive. This worked fine, until a few days ago I needed to restart the server, and suddenly all the containers didn’t show up anymore. I really cant explain how the nextcloud instance ran fine before the restart and suddenly everything was broken after the restart.
I have a (yes, very crude) backup of the entire /var/snap/docker/common/var-lib-docker
directory though and thought that just replacing that should work. But it didn’t. The mastercontainer starts fine, but the apache and database-container seemed to complain about missing writing privileges. Output from the logs (both repeated multiple times):
DUMP dir is not writeable by postgres user.
Cannot write to /mnt/data
So that didn’t help me much. The next thing I thought was “all the persistent data in docker setups is stored in volumes, maybe just setting up a new aio instance and replacing the volumes will work”. Of course that also didn’t do it, now the database-container gives me this output (repeated multiple times):
Setting max connections...
PostgreSQL Database directory appears to contain a database; Skipping initialization
2023-01-22 22:28:17.517 UTC [12] LOG: starting PostgreSQL 14.6 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit
2023-01-22 22:28:17.517 UTC [12] LOG: listening on IPv4 address "0.0.0.0", port 5432
2023-01-22 22:28:17.517 UTC [12] LOG: listening on IPv6 address "::", port 5432
2023-01-22 22:28:17.528 UTC [12] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-01-22 22:28:17.540 UTC [20] LOG: database system was interrupted; last known up at 2023-01-21 10:39:02 UTC
2023-01-22 22:28:17.682 UTC [20] LOG: database system was not properly shut down; automatic recovery in progress
2023-01-22 22:28:17.688 UTC [20] LOG: redo starts at 0/43F596F8
2023-01-22 22:28:17.689 UTC [20] FATAL: could not open file "base/16384/16554_vm": Permission denied
2023-01-22 22:28:17.689 UTC [20] CONTEXT: WAL redo at 0/43F5C328 for Heap/UPDATE: off 7 xmax 1426133 flags 0x01 ; new off 1 xmax 0; blkref #0: rel 1663/16384/16554, blk 0 FPW
2023-01-22 22:28:17.690 UTC [12] LOG: startup process (PID 20) exited with exit code 1
2023-01-22 22:28:17.690 UTC [12] LOG: aborting startup due to startup process failure
2023-01-22 22:28:17.692 UTC [12] LOG: database system is shut down
touch: /mnt/data/export.failed: Permission denied
pg_dump: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
pg_ctl: PID file "/var/lib/postgresql/data/postmaster.pid" does not exist
Is server running?
Database dump unsuccessful!
In conclusion: I have an entire /var/snap/docker/common/var-lib-docker
directory containing only a nextcloud aio instance that won’t start anymore and I want to restore the state of that instance is some way. Is that possible? Thanks in advance!