-
Notifications
You must be signed in to change notification settings - Fork 26
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
Migrate from d4m-nfs to native Docker NFS Volumes discussion #55
Comments
+1 |
EDIT to explain better what I understood after more debug. The new version moved to Linuxkit that is a read-only system. But you might have a magic solution! I am sure you have one, right? :/ cc @if-kenn |
The brief time I have had to look into this comes to the same conclusion as @Plopix. With the latest release of Docker for Mac, Docker has again changed the way in which MobyVM sees the Mac's file system. This would force us to reverse to a previous, more fragile and much harder to maintain way that we injected the script to setup NFS. With this latest change, I need to revisit if the osxfs volume performance tuning has finally caught up enough to stop the need for d4m-nfs. This whole time I have been honestly hoping to deprecate this software once there was a better solution from Docker. I will report back my findings and the future of d4m-nfs. For now I am going to put a big warning in the README. |
README has been updated, performance testing and outcome will have to wait until tomorrow. |
thanks @if-kenn, to me the osxfs volume performance tuning does not help as our main issue here is the |
Also I dig a bit more on But the NFS solution was nice, simple, and much more transparent! we have to find a way! # docker-sync.yml
version: "2"
options:
compose-file-path: 'docker-compose.yml'
compose-dev-file-path: 'docker-compose-dev.yml'
syncs:
project-sync:
sync_strategy: 'native_osx'
src: './'
sync_userid: '501' # to be adapted
# optional, a list of excludes
sync_excludes: ['.git', '.gitignore', '.DS_Store', '.idea', 'docker-sync.yml', 'docker-compose.yml', 'docker-compose-dev.yml', 'etc.'] |
I'll just put it here in case someone already upgrade their docker and want the previous version: |
@if-kenn my recent testing of osxfs volume tuning (about a month ago) found that rails rake tasks ran about 10-15 times faster under d4m-nfs |
So some bad news. While you can still screen into the Linux VM, it is a read only root file system. The way that d4m-nfs works is to be able to add the |
I am looking at the possibility to roll a new OS image for Docker for Mac from Linuxkit to understand if it is possible to mount / read/write or roll an image with the nfs package already on it. The problem with this it is not light weight (read: could take a while to make the image and something we cannot support) or there would have to be a trust factor of any OS image that would come from doing it and centrally disseminating it. |
So an update, I have been playing with Linuxkit and have been able to have a writable root file system, install nfs-utils and run rpcbind. What I have not been able to do is mount the Mac's NFSd, it appears that it is being blocked by how VPNKit is setup. The documentation on all of this is not the easiest to understand what needs to be done. If anyone has knowledge of VPNKit and how it relates to Linuxkit, that would be quite helpful. |
So, a very small break through. On a customized Linuxkit build, I have been able to successfully mount NFS from Mac host using the IP (192.168.65.2) I found on https://github.com/moby/vpnkit/blob/master/docs/ethernet.md. That said, I have yet to find a way to programmatically get that IP, and after that there would still be the need to get rpcbind service used in the correct Linuxkit way, and then feed the d4m-nfs info over to it. |
It looks like according to https://github.com/linuxkit/linuxkit/blob/master/docs/platform-hyperkit.md we can rely on the virtio-net IP to be 192.168.65.2 by default unless it was to be assigned a fixed IP via |
We could use it as default value, and in case specify it it as a configuration value, what do you think? |
@pensiero Yes, that is my intention, but let me be very clear, this is not an easy fix, it will not just be a drop in replacement and the solution will not come quickly if at all. In that light please keep the following in mind:
So if you are looking for a fix soon, please downgrade to an older version of Docker for Mac. I am intending to keep updating on progress here in order to provide transparency or if others have insights that might help. |
See the details here docker/for-mac#2419 (comment) We moved to a read only rootfs as we now boot off an ISO, as Kubernetes is too large to boot out of a writeable RAM filesystem. It would have been easier if you had always used a privileged container for NFS, rather than assuming that the host would have a working Alpine system, as this was never a guarantee. You should be able to run NFS fine with either a privileged Docker container or a privileged containerd container. The host static IP shouldn't change; there is also a DNS name for it documented. You should not need to respin a whole LinuxKit image, and if you use a privileged Docker container set to always restart it should work reasonably well. |
@justincormack from what I am understanding from David Scott's comment and what I can make of yours above, I have tried to prototype what is suggested, to no luck. Unless there is some magic that I am missing, it seems like building a new Linuxkit image is still needed. |
@if-kenn What i don't anderstand is there is native nfs volume in docker, why not use them ? (end of this page: https://docs.docker.com/engine/reference/commandline/volume_create/#driver-specific-options) From what i found, it is because docker for win (and from what i see maybe docker for mac too) don't have the NFS utils to mount nfs. Did you manage to find a way without relying on a custom VM/ISO linuxkit image ? |
Hum really strange!
It works fine! I don't undestand how docker manage to do it has there is no nfs tools on the VM.... |
It seems the no-lock option did the trick:
|
@Yivan so with your one volume creating command, you can work like before? Is the volume persistent, or do you need to recreate it after docker restart. |
@yvess yes you can work as usaually and the volume is like other volume, so it persiste as long you don't delete the VM. |
@Yivan currently I'm using shared folder for application code in my docker-compose.yml.
How can I convert this so that NFS is used? Many thanks. |
@Yivan with docker-compose I get a timeout error even if I provide the nolock option |
If you mount it directly from a container does it work ? (you can create an Ubuntu container, install nfs client, and mount the NFS share).
|
@Yivan could you please create a demo and share it (new git repo)? I'd like to use NFS for the folder containing my rails apps. |
There is no need i set a new repo for just two lines of code...
Did you try what i suggest you (mount it manually, disable firewall, etc.) ? What are the results ? |
Give this fix a try: docker/for-mac#2419 (comment) |
Yeah, I was confused with it too. |
@maurosbu I think they added some support for nfs in the moby vm, like what this project attempts to do, but it was perhaps not so much to address the mac filesystem part, but rather as part of better support for kubernetes. |
Did someone test if now the Linux Kit let us do
That would mean we can mount like before and use |
I can answer my own question I have just tested. => no we cannot use But we can definitively do as mentioned by @myers, just did and it is working great. One thing though, you need to export explicitly what you want to mount. |
have you tried the from mac os's
|
hey hey @myers of course! That is working! Awesome! Thank you! |
@Plopix Can you share a step-by-step guide? 🙏 |
@sponomarev, I have just followed what @myers provided actually. If your OSX is correctly set to
Don't forget to restart Then I have a docker-compose.yml for Linux users (here is an extract regarding the mounts) engine:
volumes:
- '${PROJECTCOMPOSEPATH}/${PROVISIONINGFOLDERNAME}/dev/engine/php.ini:/usr/local/etc/php/php.ini:ro'
- '${PROJECTCOMPOSEPATH}:${PROJECTMAPPINGFOLDER}:rw'
Then OSX users would run docker-compose using an override: And in this override: version: '2.1'
services:
engine:
volumes:
- "nfsmount:${PROJECTMAPPINGFOLDER}"
volumes:
nfsmount:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,lock
device: ":${PROJECTCOMPOSEPATH}/" That is it, @myers thanks again. We don't really need
|
Thrilled to see that d4m-nfs is not needed! |
I blogged about my solution here https://medium.com/@sean.handley/how-to-set-up-docker-for-mac-with-native-nfs-145151458adc |
@Plopix @seanhandley I just tried the nfs setup mentioned above with latest docker for mac on a ruby on rails app that has been using docker setup for a while (and previously was using d4m-nfs successfully before this issue) - I run into this issue of inability to get file locks (from rack-attack) on first reload of a page
I didn't run into this problem with d4m-nfs prior to the version of docker that broke it. Any clues as to what needs to be in place to insure file locking works as expected? |
@seanhandley many thanks for your post, I commented it with the following two questions:
|
@patakijv You could try setting |
I found I couldn't get it working on NFSv4 @maurosbu so I downgraded. You can try it and see what happens. As for relative paths - I'm not sure. Try it and see? |
@seanhandley It doesn't work. I modified your script in order to force the use of NFSv4 by appending the following line to /etc/nfs.conf
Then within the container I did a check and I discovered that version 3 is used:
Relative paths are not working. |
@seanhandley I was actually using lock in the options as seen above in @Plopix's post, I hadn't seen your nolock usage I am using /etc/exports docker-compose-dev.yml
Where |
Not sure which of the following changes resolved my locking issue but it is now apparently resolved:
For a new docker-compose-dev.yml volume mount entry
Haven't yet done any file write speedtests or comparisons between using vs not using this setup. |
Glad it works @patakijv - do please share your speed findings 👍 |
For me, MacOS 10.13.4 (17E199), works set up device like: @seanhandley many thanks for your post |
We are officially deprecating this project. We will leave it in place in case it can help some people migrate to NFS volumes from the command line or compose. |
Since this took a bit of time and I wanted to share this with others (I hope this is the right place), here's the solution we've ended up with based on the work of @Plopix, @patakijv and @birkof:
(we have our local application contents in |
It doesn't work with Docker for Mac Version 17.12.0-ce-mac46
The text was updated successfully, but these errors were encountered: