Comments (5)
In a container volume mount, you specify a path on your host (as long as it's in /Users). Since that maps to /Users inside the VM, it will be available to mount inside the container. Examples:
-v /Users/phpguru/project/application/folder:/app
-v $(pwd):/app
from docker-machine-nfs.
So any mounts I have just instantly become NFS then? Wow, it's too simple then. Now how to go about fixing permission problems? I know, that's the holy grail, right? docker run -v /my/projects/project:/var/www/html ...
is owned by 502:dialout and since cache and logs are in there, the app won't run because it can't create cache and logs.
Edit: After searching around, I tried this in the container.
$ useradd -u 502 web
$ usermod -G www-data web
Now, ls -la /var/www/html
says owned by web:dialout and I can chmod & chown.
from docker-machine-nfs.
@phpguru Hmm odd you have to change the permissions ... normally it should work due to following nfs instruction in the /etc/export file
echo '\n"/Users" '$prop_machine_ip' -alldirs -mapall='$(id -u)':'$(id -g)'\n' | sudo tee -a /etc/exports && \
awk '!a[$0]++' /etc/exports | sudo tee /etc/exports
You see the part -mapall='$(id -u)':'$(id -g)'
, this is normally the user and group from your host ... How did you run the docker-machine-nfs
tool?
from docker-machine-nfs.
Well, it's brilliant. I'm using the default docker-machine so I just did
docker-machine-nfs default
That succeeded.
$ id geoffh
uid=502(geoffh) gid=20(staff) ...
My Mac OS UserID is 502 (user didn't exist in Ubuntu) Group "staff (20)" maps over to 'dialout:20' on Ubuntu. This was on Ubuntu.15-10 if that helps. So I just created & forced a new user, web, to be uid 502 on Ubuntu and added that user to the www-data group. There's probably a fancier, more portable way to deal with this but for moving forward in development I'm good to go, I believe. Thanks for working out this tool!
I should mention that inside the docker machine, /Users is properly owned by geoffh:staff. Does that mean something isn't right in the way I'm creating mounts for containers?
Here's my docker run command:
docker run -d \
--name web \
-p 80:80 \
-p 9000:9000 \
-e APP=web \
-v /Users/geoffh/Code/projectA:/var/www/html \
-v /Users/geoffh/Code/projectB:/var/projectB \
-t ubuntulamp:latest
from docker-machine-nfs.
Hey @phpguru ,
I misread your initial question about permissions. You were talking about inside the container, while I was only talking about the virtualbox nfs share.
But yes, regarding permissions this is another story not related to the nfs one. I don't really have issues when using apache setup (through the official php-apache image), however I know I had issue with a nginx setup where I had to do something like usermod -u 1000 www-data
But whether you use nfs or any other file sync system, it's the same "problematic".
Cheers
from docker-machine-nfs.
Related Issues (20)
- macOS Catalina HOT 17
- Cannot detect the NFS mount HOT 8
- How to specify uid / gid in /etc/exports
- checkMachineRunning invalid filter
- Are some still using this? HOT 1
- mounting {ip}:/Users on /Users failed: Bad file descriptor HOT 6
- Adding mount with similar machine name causes error HOT 3
- Support for Docker for Mac HOT 3
- So frustrated with docker for mac HOT 1
- Bug with 10 or more virtualbox network adapters HOT 1
- VMWare Fusion problems on macOS 10.12 HOT 1
- Not working with Parallels 12 Pro on Sierra HOT 3
- /usr/local/bin/docker-machine-nfs: 130: /usr/local/bin/docker-machine-nfs: Syntax error: "(" unexpected (expecting "}") HOT 2
- <3 HOT 1
- Stale file handle HOT 4
- Change document root
- Not syncing files properly in High Sierra HOT 21
- grep is not working HOT 4
- NFS mount fails with boot2docker v18.09.0 HOT 10
- Support docker-machine-driver-vmware and use machine ip for route
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-machine-nfs.