Closed lfv89 closed 5 years ago
You will need to start the Docker app, then on the command line run "d4m-with-nfs.sh", then your normal docker compose up.
You will also need to modify your compose volume mounts to use /mnt instead of /Users
See https://github.com/IFSight/d4m-nfs/tree/master/examples and compare the docker-compose-traditional.yml and docker-compose-with-nfs.yml and see if that clears things up for you.
We have a wrapper script that ensures the docker for mac app is running and a few other things before calling docker-compose. In this wrapper, before the docker-compose call, is where we added the d4m-with.nfs.sh call.
After you docker run
or docker-compose up
via your example scripts and you want to enter the docker container, do you continue to use the standard docker exec -it CONTAINER_NAME /bin/bash
?
It is hard to tell because in your notes you have a line that says "To connect to the D4M moby linux VM use: screen -r d4m" yet its not clear if by "connect" you mean "instead of docker exec" or if that note is referring to something different.
Screen connects you to the VM (docker for mac/moby) that the containers run on top of. You could run the docker exec /bin/bash from moby, but it makes more sense to run it from your mac, and not moby. As long as 'docker ps' works from mac CLI, 'docker exec' should work as well.
Basically only use the screen command to debug/extend d4m-with.nfs.sh. All your docker-compose commands will still be run just like you had them before.
@lfv89 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 pattern. Look at d4m-nfs/example/d4m-nfs-mounts.txt to get an idea.
If you still have problems, post your composer YML file and what you have setup for d4m-nfs/etc/d4m-nfs-mounts.txt
I agree that is needed a better step by step guide in order to use this project, for instance, If I have something like this in my docker-compose.yml
:
web:
build: .
dockerfile: ./Dockerfile.app
expose:
- "9000"
- "9001"
links:
- redis
container_name: my_project
volumes:
- /Users/briones/project:/var/www/project
Then I need to add this to the file etc/d4m-nfs-mounts.txt
? :
/Users/briones/project:/mnt:0:0
/Volumes:/Volumes
/private:/private
And this means that I need to delete the volumes
section on my docker-compose.yml
?
https://github.com/laradock/laradock/issues/353#issuecomment-262897619
This is my approach and it works. I hope it helps.
It could be used as an example
@maurosbu approach was added in the doc of laradock https://github.com/laradock/laradock#Speed-MacOS and will be keep up to date.
I also found setup a bit confusing. There are 3 scripts, install.sh, d4m-nfs.sh, and bin/d4m-nfs-start.sh. When do I use each script?
The fourth paragraph of the readme says:
In order to make use of NFS, you will want to run d4m-nfs.sh before bringing up your containers. You will either need to change your volume paths to use /mnt, or configure the mounts in etc/d4m-nfs-mounts.txt. Look at the example directory for docker or docker-compose simple examples and an example d4m-nfs-mounts.txt.
The install.sh was a PR, the README does need an update for what it does, see pull/29:
I got it all up and working from trial and error :) It is working great, I really appreciate this project.
I think there should be a simple section How-To section even if it is simply
run ./d4m-nfs.sh
before bringing up your containers
A little visual separation goes a long way.
I'm still very confused how this all works even after reading all the comments. Can someone show me exactly what a docker-compose.yml file should look like for a simple php project and what should be in the d4m-nfs-mounts.txt file in the etc folder for this to work? I keep getting errors when I run. Here is the errors.
distribution:d4m-nfs myusername$ sh d4m-nfs.sh -e # d4m-nfs exports
"/Users/myusername/Documents/Website/thewebsite/web" -alldirs -mapall=0:0 localhost "/Volumes" -alldirs -mapall=0:0 localhost
[d4m-nfs] Copy the Moby VM APK Cache back. exports:1: got options with no exported directory: -e # d4m-nfs exports [d4m-nfs] Something is wrong with your /etc/exports file, please check it.
To be clear this happens when I run the script 'sh d4m-nfs.sh' as instructed. I get this as the main error, exports:1: got options with no exported directory
@TheDagger Did you look at the example folder listed in the Oct 27th comment?
Yes, I posted a new issue with more details to help solve my issue. (https://github.com/IFSight/d4m-nfs/issues/38) , let me know if I'm missing any details that might help you figure out what I'm doing wrong.
I created a nice step by step guide here (http://stackoverflow.com/questions/38168130/docker-on-osx-slow-volumes/42679301#42679301), look at my answer (joseph astrahan)
@TheDagger thank you for the step-by-step guide.
Though it is relatively easy, I think a detailled "how to" in the repo README be a plus, anyhow.
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.
Hello! I would love to use this solution but I don't understand how to correctly change my current docker-compose setup to use your solution. What do I have to run? Do I have to add a d4m-with-nfs.sh anywhere? If so do I have to execute it before running docker compose? Could I still run just
docker-compose up
?I might be asking a lot but could you help me through this?
Thank you.