Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
None
-
Docker container using compose
Description
Hi,
I found a few issues related to this but couldn't nail anything down close to the exact matter describing below, hence creating a new ticket.
This is about the MariaDB changing the permissions on the bind mount to a level such that it becomes read-only, then fails to write to the directory, resulting a failure.
First block below is the error from the docker logs. Second is the compose file I used to build the docker containers.
|
2022-08-10 20:25:51+00:00 [Note] [Entrypoint]: Initializing database files
|
2022-08-10 20:25:51 0 [Warning] Can't create test file /var/lib/mysql/da60fb480af6.lower-test
|
/usr/sbin/mariadbd: Can't change dir to '/var/lib/mysql/' (Errcode: 13 "Permission denied")
|
2022-08-10 20:25:51 0 [ERROR] Aborting
|
|
Installation of system tables failed! Examine the logs in
|
/var/lib/mysql/ for more information.
|
|
The problem could be conflicting information in an external
|
my.cnf files. You can ignore these by doing:
|
|
shell> /usr/bin/mariadb-install-db --defaults-file=~/.my.cnf
|
|
You can also try to start the mysqld daemon with:
|
|
shell> /usr/sbin/mariadbd --skip-grant-tables --general-log &
|
|
and use the command line tool /usr/bin/mariadb
|
to connect to the mysql database and look at the grant tables:
|
|
shell> /usr/bin/mysql -u root mysql
|
mysql> show tables;
|
|
Try 'mysqld --help' if you have problems with paths. Using
|
--general-log gives you a log in /var/lib/mysql/ that may be helpful.
|
|
The latest information about mysql_install_db is available at
|
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
|
You can find the latest source at https://downloads.mariadb.org and
|
the maria-discuss email list at https://launchpad.net/~maria-discuss
|
|
Please check all of the above before submitting a bug report
|
at https://mariadb.org/jira
|
|
2022-08-10 20:25:59+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.3+maria~jammy started.}}
|
Compose file:
services:
|
db:
|
# We use a mariadb image which supports both amd64 & arm64 architecture
|
# image: mariadb:10.6.4-focal
|
image: mariadb
|
# If you really want to use MySQL, uncomment the following line
|
#image: mysql:8.0.27
|
command: '--default-authentication-plugin=mysql_native_password'
|
volumes:
|
- ./wp_db:/var/lib/mysql:rw
|
# - type: bind
|
# source: ./wp_db
|
# target: /var/lib/mysql
|
# # - ./wp_db:/var/lib/mysql:rw
|
restart: always
|
environment:
|
- MYSQL_ROOT_PASSWORD=somewordpress
|
- MYSQL_DATABASE=wordpress
|
- MYSQL_USER=wordpress
|
- MYSQL_PASSWORD=wordpress
|
expose:
|
- 3306
|
- 33060
|
wordpress:
|
image: wordpress:latest
|
ports:
|
- 8008:80
|
restart: always
|
volumes:
|
- ./wp_site:/var/www/html
|
environment:
|
- WORDPRESS_DB_HOST=db
|
- WORDPRESS_DB_USER=wordpress
|
- WORDPRESS_DB_PASSWORD=wordpress
|
- WORDPRESS_DB_NAME=wordpress
|
Server OS information
$ uname -a
|
Linux SynologyDS 4.4.180+ #42661 SMP Mon Jun 27 15:07:23 CST 2022 x86_64 GNU/Linux synology_broadwellnk_1621xs+
|
Notes
There are two containers created by the compose file. First is the MariaDB and second is the Apache HTTPD.
Both does the same thing, just bind a read-write (./wp_site:/var/www/html) from the host to the container. Apache HTTPD writes without an issue MariaDB fails (I tried ./wp_db:/var/lib/mysql, ./wp_db:/var/lib/mysql:rw without luck) with aforementioned error. For me, the issue happens only on the above Linux OS, not producible on MacOS.