I'm trying to run a MariaDB container on a raspberry pi. The container is created through docker-compose and to persist the data I want to use my NAS. To mount a directory from the NAS to the container I want to use NFS.
The container is able to spin up, but MariaDB does not start correctly, stating that it is not able to lock the aria control file. When I spin up the container without the NFS mount (so with the storage defined inside the container) it works without an issue.
logging from the mariadb container:
2022-03-26 16:46:57+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.1+maria~focal started.
2022-03-26 16:46:58+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-03-26 16:46:58+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.1+maria~focal started.
2022-03-26 16:46:59+00:00 [Note] [Entrypoint]: Initializing database files
2022-03-26 16:50:40 0 [ERROR] mariadbd: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2022-03-26 16:47:05 0 [ERROR] mariadbd: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 37. Will retry for 30 seconds
2022-03-26 16:50:40 0 [ERROR] Plugin 'Aria' init function returned error.
2022-03-26 16:50:40 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2022-03-26 16:50:40 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2022-03-26 16:50:40 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-03-26 16:50:40 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-03-26 16:50:40 0 [ERROR] Failed to initialize plugins.
2022-03-26 16:50:40 0 [ERROR] Aborting
This is my docker compose file:
version: "3.8"
services:
mariadb:
image: arm64v8/mariadb:10.7
container_name: mariadbtemp
restart: unless-stopped
security_opt:
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --skip-grant-tables --innodb-buffer-pool-size=128M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
volumes: # Don't remove permanent storage for index database files!
- mariadbtemp:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: <password>
MYSQL_DATABASE: photoprism
MYSQL_USER: photoprism
MYSQL_PASSWORD: <password>
volumes:
mariadbtemp:
driver_opts:
type: nfs
o: addr=<ip-adress>,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14
device: :/DataVolume/databases
output of cat /etc/exports
from the NAS:
/nfs *(rw,sync,no_subtree_check,all_squash,insecure,anonuid=500,anongid=1000)
/DataVolume/databases <ip-adress of dockerhost>(rw,sync,no_subtree_check,insecure)
output of ls -aln /DataVolume/databases
on the NAS:
total 320
drwxr-xr-x 2 999 999 65536 Mar 26 16:20 .
drwxr-xr-x 8 0 0 65536 Feb 7 14:21 ..
-rw-rw---- 1 999 999 16384 Mar 10 19:32 aria_log.00000001
-rw-rw---- 1 999 999 52 Mar 10 19:32 aria_log_control
-rw-rw---- 1 999 999 9 Mar 26 16:20 ddl_recovery.log
---------- 1 999 999 0 Mar 10 19:20 ibdata1
I have tried to mount the NFS share directly to the container, defining the NFS-share as external and configuring it through docker and also to mount the NFSshare to the docker host and trying it that. None have worked. Does anyone have a suggestion as to how to continue?