-
Notifications
You must be signed in to change notification settings - Fork 444
Need help on persistence data for Mariadb in Docker Container using latest image #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As a bit of a guess without an Mac environment, add Otherwise check the owner/group as it exists within the container with:
|
seems no equivalent stat command option on mac as in linux, i find the uid,gid of the directory manually and run the command, still got errors. as the container already exit, can't check the owner/group within the container.(base) fulwang@MacPro ~ % Installation of system tables failed! Examine the logs in The problem could be conflicting information in an external
You can also try to start the mysqld daemon with:
and use the command line tool /usr/bin/mariadb
Try 'mysqld --help' if you have problems with paths. Using The latest information about mysql_install_db is available at Please check all of the above before submitting a bug report |
My mac is running MacOS 12.4 Monterey (Chip: Apple M1 Pro) |
Guess Did you look at:
Or:
The uid/gid it appears as inside the container may be different. I assume you have file shared this path like https://stackoverflow.com/questions/58341846/how-to-mount-volume-to-docker-on-osx. |
Did you look at: docker run --rm -v $HOME/mysql/data:/var/lib/mysql mariadb:latest ls -la /var/lib/mysql Here is the output:(base) fulwang@MacPro ~ % |
Just use bind mount (persist the mariadb datadir to macos local filesystem), no docker desktop installed and not using volumes |
So summarizing:
While changing the root behaviour to continue as root if it can't chown the volume is possible (and might have consequences), I'd rather use other options if possible. https://docs.docker.com/desktop/mac/ recommends using named volume/data container for database volumes. Is there are reason you aren't doing this? The other option in the docker docs is VirtioFS. I don't know if it will present user/groups differently or permit chown of them. |
Thanks @grooverdan! One question, do you mean during the Mariadb container startup it will try root/non-root mode automatically in the background? And I'd try the named volume option later. no particular requirements in my project for selecting the persisting solution, i just try the options we have and make some comparisons before the real deployment. |
Not so much background, as early stages of the entrypoint like what the 99 [issue did|https://github.com/neam/docker-stack/blob/develop/stacks/neam/debian-php-nginx.dna-project-base/stack/localdb/run.sh]. The workaround around will fail in singularity (like #401) as the non-volume is mounted RO during runtime (that I need tests for). So yes, please use named volumes like the Docker documents recommend. If you do any virtiofs test I'm interested in the results. |
I want to persist Mariadb's datadir to local directory on my mac, but it doesn't work if i add the bind mount parameter.
without the bind mount setup, i can see the Mariadb service can startup normally.
(base) fulwang@MacPro ~ % docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
(base) fulwang@MacPro ~ %
(base) fulwang@MacPro ~ %
(base) fulwang@MacPro ~ % docker run --detach --name pmariadb --env MARIADB_ROOT_PASSWORD=123456 -v $HOME/mysql/data:/var/lib/mysql mariadb:latest
47eaaaf4d64b7ed49ecd3be932a3dc95f3c3273d27c850ebb2fa1bc8b36bc95c
(base) fulwang@MacPro ~ %
(base) fulwang@MacPro ~ % docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
47eaaaf4d64b docker.io/library/mariadb:latest mariadbd 30 minutes ago Exited (1) 30 minutes ago pmariadb
(base) fulwang@MacPro ~ % docker logs pmariadb
2022-07-14 06:59:25+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.3+maria~jammy started.
chown: changing ownership of '/var/lib/mysql/': Operation not permitted
(base) fulwang@MacPro ~ %
(base) fulwang@MacPro ~ %
(base) fulwang@MacPro ~ % ls -l $HOME/mysql/data
total 0
(base) fulwang@MacPro ~ % ls -l $HOME/mysql/
total 0
drwxr-xr-x 2 fulwang staff 64 Jul 14 15:29 data
(base) fulwang@MacPro ~ %
The text was updated successfully, but these errors were encountered: