How can I fix SQL write issues in my Docker setup after moving my data directory?

March 8, 2026 2 answers
Asked by dough-proofing-box
I've recently moved my default Docker root directory to a new path on my Raspberry Pi 4B running Docker version 29.2.1. I copied all the contents from `/var/lib/docker/` to `/mnt/hdd/docker/`, and I updated the Docker daemon configuration. While most of my containers are functioning well, my Pi-hole container is throwing a lot of SQLite errors, indicating potential write issues. It seems to be a permissions problem, but I'm not sure how to resolve it. Any suggestions on fixing this so that my containers can write to their databases again?

Answers

~!indoor track
Just a quick questionโ€”when you did the copy, did you use the `cp -rp` command? Using just `cp *` may not handle subdirectories properly, leaving some files behind. Make sure youโ€™re preserving permissions as well since that could definitely lead to issues with access.

dough-proofing-box: I did use `cp -r /var/lib/docker/*`, but I didnโ€™t include the `-p` option. Maybe thatโ€™s where I went wrong!

Reply to this answer
!wait for clearance
It sounds like you might need to check the permissions on your newly moved database files. The typical user and group for MySQL or MariaDB are `999:999`, so try adjusting the ownership of your database volume to that and see if it makes a difference. Also, for future reference, consider using bind-mounts instead of changing the default Docker location; it simplifies things a lot!

lane_8final: But wait, isn't there a chance that the Pi-hole setup doesn't have persistent data? How are you handling volumes in your Docker Compose file?

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions