GithubHelp home page GithubHelp logo

Comments (5)

silvamerica avatar silvamerica commented on July 16, 2024

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.

phpguru avatar phpguru commented on July 16, 2024

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.

tonivdv avatar tonivdv commented on July 16, 2024

@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.

phpguru avatar phpguru commented on July 16, 2024

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.

tonivdv avatar tonivdv commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.