-
Notifications
You must be signed in to change notification settings - Fork 443
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
on windows, cannot start a container with host directory as /var/lib/mysql mount #95
Comments
I can almost guarantee that the If you need to set the user that mysqld uses, you can just set the user on docker run |
@yosifkit All the same.
I will try mount a Windows directory as a folder inside Docker VM VirtualBox. |
It's work with Docker VM on VirtualBox. |
Hello I'm facing the same trouble. MariaDB 10.1.23 and 10.2.7 I would like to keep using Hyper-v, how can I solve this ? |
Same here. |
@sbernaldev and @Chrisly3ear, I believe the current workaround is to not use a host mounted volume with The other alternatives are to use Docker Toolbox instead of Docker for Windows, or to use a different SQL database (all versions of MySQL work with a host mounted volume in Docker for Windows, as does Percona 5.5 and 5.6). I don't have any insight as to why Percona 5.7 and all versions of MariaDB fail when using a host mounted volume on Docker for Windows. I am too unfamiliar with their code to find and fix the issue whether it is in MariaDB/Percona or Docker for Windows. |
Having the same issue here |
+1 |
Docker for Windows based on Hyper-V is a native Windows 10 docker solution. Being able to mount custom persistent storage from host is in my opinion crucial. |
As a temporary solution, you can do so(in your docker-compose.yml) this is solution for laradoc package:
|
This has to be a mariadb issue. In my compose file for my phpfpm service use:
which works inspect shows:
...
I can modify the files on the host side on the volume mapping everything works as expected. when I try the same for mariadb service there are problems, for my db service:
but when I up the mariadb compose I get: mysql_1 | 2017-12-12 9:53:49 139728345196416 [ERROR] InnoDB: Write to file ./ibdata1 failed at offset 0, 1048576 bytes should have been written, only 0 were written. Operating system error number 22. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded. inspecting the container shows:
...
The service did write in to the mapped volume ./data:
I have also tried using docker run with -v and I get the same outcome. Interestingly enough, as neuotq suggested if you use the docker internal volumes, then it works. |
Same issue here, this is critical bug honestly, any solutions? |
@sameronline yes, see #95 (comment) Essentially, the best solution is to put |
Same here on Mac! This is an critical issue. |
Yeah, just use a named volume and connect it to more than one container. However, note that using a named volume already makes the database persistent -- the volume will outlive the container by itself without any additional intervention. |
Seeing a similar issue with mariadb10.2.X
I have specified a single Builds fine, no errors, but using this The terminal output on run and errors are:
Environment Details:
Any pointers to a solution when using a Dockerfile and not docker-compose.yml file appreciated. |
@StevenWillett, the To use the already defined volume on Docker for Windows you have to use a named volume like @tianon suggested in the comments above yours. $ docker run -d -p 3306:3306 --name mariadb -v mysql-data:/var/lib/mysql stevenwillett/mariadb
$ # to see the volume
$ docker volume ls Unfortunately, you cannot mount the folder for MariaDB to the host using Docker for Windows because it presents the shared files/folders permissions to the Linux container as root owned with writable only by root (755). See also docker-library/percona#42 (comment). |
Thanks, @yosifkit, For those interested or facing similar issue ${pwd} is your friend here: Dockerfile: (Note: removal of VOLUME entirely)
NOTES: Notice I have fully removed the Docker run command:
You will most likely want to also add the run command option for
So the updated
If anyone is able to achieve the below run command option as part of the Dockerfile build I would be grateful to hear how instead of needing to include as part of the
What I have found out through trying to resolve this issue on Windows is that I hope the above helps someone else facing a similar issue. |
Correct me if I'm wrong but it seems since 17.06 docker changed
I want to run |
@csandanov, 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. PS C:\Users\sauron> docker run -it --rm -v C:\Users\sauron\tmp\:/my-tmp/ -u 1000:50 debian
I have no name!@664436f5a386:/$ id -u
1000
I have no name!@664436f5a386:/$ id -g
50
I have no name!@664436f5a386:/$ cd /my-tmp/
$ # it presents as a root owned folder but doesn't allow chown/chmods
I have no name!@664436f5a386:/my-tmp$ ls -al
total 4
drwxr-xr-x 2 root root 0 Apr 10 20:44 .
drwxr-xr-x 1 root root 4096 Apr 10 20:47 ..
$ # and doesn't respect the permissions that it presents
I have no name!@664436f5a386:/my-tmp$ touch foo
I have no name!@664436f5a386:/my-tmp$ ls -l
total 0
-rwxr-xr-x 1 root root 0 Apr 10 20:48 foo
I have no name!@664436f5a386:/my-tmp$ |
@yosifkit the same problem exists with Docker for Mac |
Hello, It's incredible that the problem persists for a year and nobody has managed to find a solution! |
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 |
Are there any requests to solve this behaviour? How would you recommend working with them toghether then? |
I changed .env file:
-->
and error fixed. |
@darkguy2008 solution works perfectly for my environment (Win10 Pro / Hyper-V) Hope this helps. |
Issue is still active for mariadb:10.4.8-bionic with Windows 10. |
Issue is still active for latest image with macOS 10.15.1. |
@darkguy2008 Thanks sir :) 👍 |
Same issue here on Windows, Docker for Desktop. |
Just a note to others. Adding If you're using WSL 2, and try to use something like:
You'll still run in to this issue... You'll need to change it to look like:
Using the Windows formatted directory location. |
So far, I haven't had any success with the above approaches except for using docker I prefer to use I guess something was introduced from 10.2 which caused this issue. Again, this is just another workaround, but if I had to choose between the two, I'd prefer downgrading MariaDB version, compared to using docker |
Did a Docker update today. Now none of these solutions work on Windows. |
@pkscout did you check this solution? Docker 2.0.0.3 |
I had the same issue, what may happen is volumes are having so much space on your Docker so just delete it and then start your container back again |
Thanks a lot, this solved my problem on Mac OS :D |
You are welcome Glad i helped you solve the problem |
Does anyone have any idea for a workaround when using Docker on Windows with WSL 2. Trying to install Seafile with following yml `version: '2.0' memcached: seafile: networks: |
Addresses: MariaDB/mariadb-docker#95 Newer versions break when using mounts on Windows and Mac devices
Tried running a mariadb container by means of docker-compose.
This trouble similar to this issue #38
docker-library/mysql#99 (comment) it doesn't solve the issue.
The text was updated successfully, but these errors were encountered: