mineshaftgap / d4m-nfs

Docker for Mac with NFS for performance improvements over osxfs
296 stars 26 forks source link

Any working examples? #19

Closed meng-tian closed 7 years ago

meng-tian commented 7 years ago

Can we have a working example please?

I got this error when run d4m-nfs.sh:

exports:1: got options with no exported directory: -e # d4m-nfs exports
exports:7: path contains non-directory or non-existent components: /Users/root
exports:7: no usable directories in export entry
exports:7: using fallback (marked offline): /
Something is wrong with your /etc/exports file, please check it.
if-kenn commented 7 years ago

As mentioned in the README.md, you can find examples in the example directory, it is impossible to guess your Mac's setup so there is no way to provide "working examples". The above output specifies a directory named "/Users/root", unless you made a user named "root" on you Mac which would most likely leave your Mac in a non-working state since it would conflict with the actual UID 0 user.

If you need further help, please provide the following:

  1. screenshot of Docker for Mac's Preferences -> File Sharing
  2. attachment of d4m-nfs/etc/d4m-nfs-mounts.txt
  3. attachment of /tmp/d4m-mount-nfs.sh
  4. attachment of /tmp/d4m-nfs-mounts.txt
  5. attachment of /etc/exports
meng-tian commented 7 years ago

I finally got d4m-nfs.sh successfully ran. But I couldn't mount /mnt/ when run docker container. I have a myproject directory in /Users/foobar, and I ran

docker run -v /mnt/myproject:/var/www/html php:7.0.6-apache

And got this:

docker: Error response from daemon: Mounts denied: e info.
.
 path /mnt/myproject
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for mor.

Here are the list of things you need:

  1. I only have /Volumes and /private and I've removed /Users.
  2. no such a file
  3. here is the content:
    
    ln -ns /tmp/d4m-apk-cache /etc/apk/cache
    apk update
    apk add nfs-utils sntpc
    rpcbind -s

DEFGW=$(ip route|awk '/default/{print $3}') FSTAB="\n\n# d4m-nfs mounts\n"

if ! $(grep ':/mnt' /tmp/d4m-nfs-mounts.txt > /dev/null 2>&1); then mkdir -p /mnt FSTAB="${FSTAB}${DEFGW}:/Users/foobar /mnt nfs nolock,local_lock=all 0 0" fi

if [ -e /tmp/d4m-nfs-mounts.txt ]; then while read MOUNT; do DSTDIR=$(echo "$MOUNT" | cut -d: -f2) mkdir -p ${DSTDIR} FSTAB="${FSTAB}\n${DEFGW}:$(echo "$MOUNT" | cut -d: -f1) ${DSTDIR} nfs nolock,local_lock=all 0 0" done < /tmp/d4m-nfs-mounts.txt fi

echo -e $FSTAB >> /etc/fstab

sntpc -i 10 ${DEFGW} &

sleep .5 mount -a touch /tmp/d4m-done

4. no such a file
5. here is the content:

d4m-nfs exports

"/Users/foobar" -alldirs -mapall=502:20 localhost

meng-tian commented 7 years ago

I am wondering is there a way of find out what available for my /mnt?

meng-tian commented 7 years ago

After I removed /Volumes and /private from docker app, and re-ran the d4m-nfs.sh, it works now.

Should I always remove /Volumes and /private?

if-kenn commented 7 years ago

@meng-tian please carefully read the README.md, many of you issues are covered there. It is addressed there that you need to remove Volumes from the D4M preferences. If you don't have the file "d4m-nfs/etc/d4m-nfs-mounts.txt" then you are not configuring it correctly, please note that I cannot guess where you cloned the repo to. There is not content to "/tmp/d4m-nfs-mounts.txt" because you did not properly configure "d4m-nfs/etc/d4m-nfs-mounts.txt". Unless your user name is "foobar" then you have something funky, if it is not, then please replace "foobar" with the name of your Mac username (not full name).

meng-tian commented 7 years ago

@if-kenn , I've followed the readme step by step this time and I've now got /tmp/d4m-nfs-mounts.txt. Is there anyway I can verify it is working?

I can now mount from /mnt, is that a valid test?

if-kenn commented 7 years ago

Yes, /mnt will only work if it is working. Let me know if it is now working and we can close this issue.

meng-tian commented 7 years ago

Yes, now I can mount from /mnt for docker containers.

Thank you!

if-kenn commented 7 years ago

Great to hear!

TheDagger commented 7 years ago

Meng-tian how did you get your d4m-nfs.sh to finally work I had the same error but I can't get past that step

meng-tian commented 7 years ago

@TheDagger It's a long time I haven't use this tool. I cannot recall what I have done to make it working. Maybe open an issue ask for help from @if-kenn ?