-
Notifications
You must be signed in to change notification settings - Fork 444
on windows, cannot start a container with host directory as /var/lib/mysql mount #38
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
Data volumes don't work either.
|
Now, I cannot save the changes in MariaDB in windows. |
+1 |
It looks like this is specifically mariadb I used the user/group id changing that was described here: docker-library/mysql#99 (comment). |
@tianon why was this closed? It appears this is still an issue. mariadb service: mariadb:
user: "1000:50"
image: mariadb
env_file:
- ./env/mariadb.env
volumes:
- ./store/mysql:/var/lib/mysql docker-compose up:
|
@markehme this was closed because it looks like we've done as much as we possibly can from the perspective of this image to make this work and that there's not really anything else we can do 😞 |
Hi all! The info here docker-library/percona#42 suggests that this indeed might be an image-related bug. It seems to work with |
version 10.1.22 The folder "MariaDB" does not have any exist files when I execute this command.
Error Log (complete):
|
Hi @yosifkit Version I used: mariadb:10.0.22 Obviously this doesn't fix the problem with boot2docker, and I tried using the script, etc as per the other solutions but nothing worked, except for the version I mentioned above. |
hi @mario-rivera, For boot2docker, we adjusted the image to be able to start as any user with #59 so the script I mentioned is no longer necessary. You can just run it on Windows or Mac when using boot2docker: $ docker run -d -v C:/Users/....:/var/lib/mysql --user 1000:50 -e MYQSL_ROOT_PASSWORD=secr3t martiadb:10.0 Unfortunately, there is something not related to permissions that causes 10.1 to fail in this scenario (a volume shared from a windows/mac host to the VM via VirtualBox Shared Folder) and all versions of MariaDB currently fail on Docker for Mac/Docker for Windows when using a volume shared from the host (docker-library/percona#42 (comment)). |
+1 |
1 similar comment
+1 |
I think it's InnoDB O_DIRECT bug. Turn off innodb_flush_method=O_DIRECT helps me. |
@igorbarkowsky |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
Setting innodb_flush_method=O_DSYNC fixed issue for me. |
+1 System: Windows 10 v1607 with Docker for Windows (Hyper-V): 17.06.0-ce-win18 (12627) (current Docker is also failing with following error message) Using latest mariadb docker image: docker-compose.yml:
Logs:
Tried Bugfix from @jszoja, unfortunately with no success. |
@rgj8 I have the same issue and the fix from @jszoja work for me, try this :
And create file
Delete old files in ./data directory and |
@LuaxY Thanks for your reply. I've tested it now with mounting the configuration folder completely to /etc/mysql/conf.d with overlaying existing files in that folder. |
Edit: The config part ( Based on the hint that the command line arguments aren't passed when the database is initialized,
db:
image: mariadb:10.2.14
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: app
MYSQL_USER: app
MYSQL_PASSWORD: test
user: "1000:50"
command: mysqld --innodb-flush-method=littlesync --innodb-use-native-aio=OFF --log_bin=ON
volumes:
- ./db:/var/lib/mysql
- ./innodb-fix.cnf:/etc/mysql/conf.d/innodb-fix.cnf
[mysqld]
innodb_flush_method=littlesync
innodb_use_native_aio=OFF
log_bin=ON I noticed that initialization and subsequent startup only work with Also note that when the database has been already initialized (and persisted, mounted host directory), |
I found that the COPY command might be inconvenient when you want to update the config file. Looks like you have to rebuild the image to have the new changes in place, whereas mounting a file/volume approach loads changes after restarting container 😉 |
@strarsis 's solution works for me. The line ' - ./innodb-fix.cnf:/etc/mysql/conf.d/innodb-fix.cnf' is not used. I'm using vbox in windows 7 and latest mariadb. |
:-(
|
@cjk: For some reasons the config file that should fix the issue is not read in your case.
Apparently because it is 'word-writable', its file permissions not restrictive enough for Also you have to let it create new database data files because when Edit: Found some source code that is somehow relevant: https://github.com/twitter/mysql/blob/master/mysys/default.c#L797 |
@strarsis yes, saw this I got it to "work" with creating an own Docker image based on mariadb with copying the file...
But when I start filling the database I get other exceptions.
I think the central point here is
and I simply think, that the filename might not perhaps not be possible on windows or is a problem with Docker Toolbox/Virtualbox or whatever. I´m giving up on using docker on windows with mysql/mariadb and install a native MariaDB-Server ... and thinking again about switching from windows to linux. |
@cljk: Not sure whether this could help, but you could try to run all this via WSL (Bash on Windows). |
I made it work again by moving the config option back to the command attribute in the yaml file. It doesn't seem to cause the issue with database initialization since it has been fixed according to previous @yosifkit comment. db10:
image: mariadb:10.0
volumes:
- ./db_data10:/var/lib/mysql:z
- ./db10.cnf:/etc/mysql/conf.d/db10.cnf:ro # doesn't work, unless you set read-only attribute in windows for this file
- ./create-dbs:/docker-entrypoint-initdb.d:z
ports:
- "3307:3306"
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
command: mysqld --innodb-flush-method=O_DSYNC #pass the config through the command It might be important to cleanup the whole db before running it with this customized command parameter. Otherwise it is too late and your DB is already corrupted as @strarsis mentioned in comment. It works for me on Windows 10 and docker 18.06.0.ce. All databases were recreated properly on the first run. Additionally I tried to set readonly mode for mounting db10.cnf file, but that didn't help and the config file was ignored by mariadb. I also made it work by setting the config file with readonly attribute in windows: right-click->properties->read-only checkbox. |
Could someone explain why this is happening? |
It works on Linux-hosts - not on Docker-Machine mapping the datadir via SMB or VM specific FS (vboxsf f.e.). I think the problem are Linux-specific file-access methods wich are not compatible on network/virtualized storage. |
FYI, the |
@yosifkit: I have to pull the recent mariadb image from Dockerhub for this fix? |
@strarsis, Correct. You'll need to pull the newer images to get that fix; which should be any image after |
The Docker Library project documents a problem with some versions of MariaDB not starting correctly when a host system directory is mounted to /var/lib/mysql. MariaDB/mariadb-docker#38 It appears to work correctly when a named volume is used; at least, it works on Windows. This should be tested on OS/X as well before being merged.
YOU ARE MY HERO!!! |
@Hobart2967 |
Windows 7 here, with kitematic. Nothing works:
|
Well dang, so many hours lost on this. Meanwhile, bitnami/mariadb just works.™ Is there a place to suggest that this bug be mentioned in the Docker Hub Caveats? |
This commit uses a named volume to work around a Windows platform bug with @leiyinmon and possibly @eguy006's setup. Using a volume in the same directory as the project causes containers to not start: MariaDB/mariadb-docker#38 Tested and confirmed locally on Linux/Fedora. Did not get a chance to test in person with @leiyinmon. Signed-off-by: Justin W. Flory <[email protected]>
* Docker Compose: Use named volume for MariaDB This commit uses a named volume to work around a Windows platform bug with @leiyinmon and possibly @eguy006's setup. Using a volume in the same directory as the project causes containers to not start: MariaDB/mariadb-docker#38 Tested and confirmed locally on Linux/Fedora. Did not get a chance to test in person with @leiyinmon. Signed-off-by: Justin W. Flory <[email protected]> * Delete 0003_auto_20191022_0148.py
For anyone who has been getting a headache (hopefully not) for a couple of days what worked for me is to downgrade to |
Also, I just TESTED this. Environment file is being ignored by mariadb for some reason, so if you have to set env vars, make sure to declare your env inside the Dockerfile. Pretty disappointing how this issue is almost 4 years old and completely ignored |
Several direct repository maintainer interactions is far from "completely ignored" 😉 What I feel is being most strongly ignored here is the sentiment from two years ago in #38 (comment) that this is not the right place to report or discuss this. We aren't going to patch quirks of MariaDB itself in this image. Full stop. If you want changes to MariaDB itself, those should be filed and discussed with the upstream MariaDB project. I'm going to lock this discussion here, because I think continuing here is counterproductive. If you would like to continue discussing workarounds, please take those discussions to dedicated support forums such as the Docker Community Forums, the Docker Community Slack, or Stack Overflow. |
Tried running a mariadb container by mounting a host directory but does not even start with no logs. My goal is to not lose the data.
The text was updated successfully, but these errors were encountered: