Skip to content
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

win+macOS: Cannot start a container with host directory as /var/lib/mysql mount #278

Closed
iredmail opened this issue Dec 4, 2019 · 3 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@iredmail
Copy link

iredmail commented Dec 4, 2019

Dear MariaDB developers and maintainers,

This is a known issue for years on both Windows and macOS platforms: can not start the mariadb container with host directory as /var/lib/mysql mount. Any possibility to fix it on MariaDB side? Without an external volume, it's impossible to run this docker image in production on Windows + macOS.

Related issues:

btw, running mariadb inside Alpine docker image has same issue.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Dec 4, 2019
@wglambert
Copy link

Linux Containers on Windows (LCOW) is an experimental feature not ready for production.

https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/linux-containers#bind-mounts

These applications all require volume mapping and will not start or run correctly.

  • MySQL
  • PostgreSQL
  • WordPress
  • Jenkins
  • MariaDB
  • RabbitMQ

https://docs.docker.com/v17.09/docker-for-windows/install/#download-docker-for-windows

. . . To run Docker Windows containers in production, see instructions for installing Docker EE on Windows Server 2016. To run Docker Linux containers in production, see instructions for installing Docker on Linux.

Docker for Mac is in the same boat. One thing you can try is using Docker named volumes instead of bind-mounts

@wglambert
Copy link

There's also a number of solutions in #95:

#95 (comment)

Essentially, the best solution is to put /var/lib/mysql in a volume on your Docker VM (managed via docker volume xyz commands) instead of trying to share those files directly all the way back to your Mac or Windows host filesystem.

#95 (comment)

Yeah, just use a named volume and connect it to more than one container.

#95 (comment)

using a named volume is basically the only option to keep the database files when running MariaDB on Docker for Windows since the host-shared folder presented to the container does not behave in a standard way.

#95 (comment)

We recently added #168 which should make sharing a directory from a windows host possible. Try the following (I don't have a host with Docker for Windows at the moment, but it worked when I last checked):

$ # also updated to specify a version of mariadb so that things don't break when latest becomes 10.4
$ docker run --name mariadb -d -v D:\Projects\docker\docker-qub:/var/lib/mysql -e MYSQL_USER=user -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=address -e >MYSQL_ROOT_PASSWORD=password mariadb:10.3 --innodb-flush-method=fsync

For future users that are using docker-compose it would be adding --innodb-flush-method=fsync to the command.


Going to close with what was said in that thread
#95 (comment)

Docker and MariaDB work fine together; the bit that doesn't work is the custom filesystem employed by Docker for Windows and Docker for Mac for sharing files across the VM boundary, which is not all that surprising for a database, which often use features like mmap for performance but thus also require support from the underlying filesystem. There are many reports of similar issues with vboxsf, for example.

#95 (comment)

Any fixes would have to happen either in Docker's shared filesystem or in MariaDB itself (not something we can really fix in this Docker image), so I'd recommend checking their respective upstream bugtrackers for any discussion of fixing the problem.

@iredmail
Copy link
Author

iredmail commented Dec 5, 2019

Thank you very much, @wglambert :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Development

No branches or pull requests

2 participants