[MDEV-27038] Custom configuration file procedure does not work with Docker Desktop for Windows 10+ Created: 2021-11-12 Updated: 2023-07-11 Resolved: 2023-07-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Docker |
| Fix Version/s: | 10.4.31, 10.5.22, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2, 11.2.1 |
| Type: | Task | Priority: | Minor |
| Reporter: | Rob Schwyzer | Assignee: | Daniel Black |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | Windows | ||
| Description |
|
Note this, general issue exists in MySQL's Docker implementation as well- The base issue stems from Docker Desktop for Windows' decision about how to translate Windows file permissions to Linux permissions-
Here is MariaDB's current documentation on how to provide a custom configuration file-
When following this procedure, users will get a warning like the below-
Note this warning does not stop the container from launching. Instead, it results in the custom configuration file(s) not being kept and therefore not being used or loaded by the MariaDB instance. Especially when deploying via docker compose, it's easy for the warning to get lost in other log output, and this can often confuse users into thinking their custom configuration is applied and working when, in fact, it is not. While there are many proposed work-arounds, the most reliable work-around I have found is to:
Below is a snippet from a docker-compose.yml which handles this-
Given the permissions of the file(s) a user supplied to MariaDB's Docker image for the purposes of configuration should never need to be 777, it might make more sense to modify https://github.com/MariaDB/mariadb-docker/blob/master/Dockerfile.template or https://github.com/MariaDB/mariadb-docker/blob/master/docker-entrypoint.sh to detect and gracefully handle when 777 or other, non-viable permission masks are detected for such files. The only problem this introduces is directly modifying the mounted file(s) may be problematic given Docker is maintaining an active link between the file outside the VM and the file inside the VM. It may make the most sense to just add a feature and update documentation to recommend Windows Docker users mount /etc/mysql/conf.windows.d/ instead and MariaDB's Docker implementation could just check if that directory exists, and if it does, just copy the contents of that directory to the target /etc/mysql/conf.d/ and ensure correct permissions post-copy. |
| Comments |
| Comment by Daniel Black [ 2023-06-15 ] |
|
rob.schwyzer@mariadb.com what do you think of https://github.com/MariaDB/server/pull/2669 to support RO mount points. |
| Comment by Daniel Black [ 2023-06-16 ] |
|
Tested successfully on Windows Docker Desktop by changing config mounts to RO. There is an aspect that GUI cannot specify RO mounts, on on the commandline. Alternate/complementary implementations:
|