mineshaftgap / d4m-nfs

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

Mounts denied #6

Closed nandra closed 7 years ago

nandra commented 7 years ago

Hi I', trying to run example ./d4m-with-nfs.sh but it fails with:

c0fb98657c9a0414d092b2c6df47ea2e0736e3a9eef6451653135e44cbd8733a
docker: Error response from daemon: Mounts denied: 
The path /mnt/www
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 more info.
..

any ideas what to check? Thanks.

if-kenn commented 7 years ago

@nandra I have now made it so that you can customize mounts that you need in d4m-nfs/etc/d4m-nfs-mounts.txt instead of having to use the /mnt patter.

Note that any paths that exist d4m-nfs-mounts.txt should be removed from the D4M Preferences -> File Sharing.

dimasch commented 7 years ago

+1 the same.

if-kenn commented 7 years ago

@dimasch please provide a screenshot of the shares you are using for Docker and the contents of d4m-nfs-mounts.txt. Without this there is no way to help you. Also please make sure you have reviewed the README.

dimasch commented 7 years ago

@if-kenn thx,

2016-11-15_23-25-19

if-kenn commented 7 years ago

@dimasch there are a few things that make this hard to figure out from what you have provided. What is the exact error you are seeing? For instance nandra had:

The path /mnt/www
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.

You shared the contents of d4m-nfs-mounts.txt, is that under the etc directory, it is obscured by the Docker preference.

Other information that would help out would be the contents of the files /tmp/d4m-mount-nfs.sh & /tmp/d4m-nfs-mounts.txt.

Also, in order to try and help or reproduce issues, when sharing the content, it is much more helpful for you to attach them instead of giving screenshots.

dimasch commented 7 years ago

@if-kenn after start composition:

ERROR: for appdata  Cannot start service appdata: Mounts denied: for more info.
.
workspace/html
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
ERROR: Encountered errors while bringing up the project.

cat /tmp/d4m-mount-nfs.sh

ln -s /tmp/d4m-apk-cache /etc/apk/cache
apk update
apk add nfs-utils sntpc
rpcbind -s

DEFGW=$(ip route|awk '/default/{print $3}')
FSTAB="

# d4m-nfs mounts
"

if ! $(grep ':/mnt' /tmp/d4m-nfs-mounts.txt > /dev/null 2>&1); then
  mkdir -p /mnt
  FSTAB="${FSTAB}${DEFGW}:/Users/sportmage /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}
${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

cat /tmp/d4m-nfs-mounts.txt /Users/sportmage/workspace:/mnt:0:0

if-kenn commented 7 years ago

Sorry to keep asking for stuff, but please also provide /etc/exports.

nandra commented 7 years ago

Ok I updated to latest version but I'm still confused how to setup to have it working. I create docker container to build linux kernel. Clone kernel to mac in /Users/marek/kernel. Then copy d4m-nfs-mounts.txt to d4m-nfs etc folder and adapt it to following: /Users/marek/kernel:/mnt/kernel

then try to run container with following: docker run -ti -v '/mnt/kernel':'/home/build/kernel' -w'/home/build/kernel' kernel:0.1 but it fails with: docker: Error response from daemon: mkdir /mnt: file exists.

Probably I'm doing some stupid things, any ideas? Thanks a lot.

if-kenn commented 7 years ago

@nandra if you want help then please provide all of 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
dimasch commented 7 years ago

@if-kenn sorry for waiting

cat /etc/exports "/Users/sportmage/workspace" -alldirs -mapall=0:0 localhost

nandra commented 7 years ago

@if-kenn 1 - https://www.dropbox.com/s/fvq0kfm2zm6npeo/Screen%20Shot%202016-11-16%20at%2017.45.49.png?dl=0

2 - cat d4m-nfs/etc/d4m-nfs-mounts.txt:

# Be sure that any mounts that have been added here
# have been removed from Docker for Mac -> Preferences -> File Sharing
# 
# You must supply the Mac source directory and Moby VM destination directory,
# and optionally add on user/group mapping:
#
# https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man5/exports.5.html
#
# <MAC_SRD_DIR>:<MOBY_VM_DST_DIR>[:MAC_UID_MAP][:MAC_GID_MAP]
#
#/Users/foobar:/mnt:0:0
#/Volumes:/Volumes
#/private:/private
/Users/marekbelisko/kernels/gta04-kernel:/mnt/kernel

3 -

cat /tmp/d4m-mount-nfs.sh
ln -s /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/marekbelisko /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

4 -

cat /tmp/d4m-nfs-mounts.txt
/Users/marekbelisko/kernels/gta04-kernel:/mnt/kernel

5 -

cat /etc/exports 
# d4m-nfs exports

"/Users/marekbelisko/kernels/gta04-kernel" -alldirs -mapall=501:20 localhost
chytreg commented 7 years ago

I've also noticed that after docket restart simple script execution doesn't work. I have to run it once then go to screen and invoke source /tmp/d4m-nfs.sh.

if-kenn commented 7 years ago

@dimasch please try with the latest commit, I think what was happening for you was a timing issue. The script now has a proper wait after the commands passed off to the screen TTY.

if-kenn commented 7 years ago

@nandra I will see if I can replicate you issue tomorrow, but in the mean time, try with the new code. Also you should know that all of /User/$USER is by default exported on NFS and mounted as /mnt so you would should not need to do your export.

if-kenn commented 7 years ago

Closing since no response.