Coder Social home page Coder Social logo

docker-volumes-permissions's People

Contributors

oleynikd avatar

Watchers

 avatar

docker-volumes-permissions's Issues

How to fix your problems

Never ever use usernames and groupnames in a Docker environment unless you can garantee that the numbers (UID,GID) are the same within all environments.

What in the end really counts are the numbers (UID and GID). The numbers is the only thing the kernel cares of and which get shared between all environments ((hosts, container A, container B).

Example:

A shared file which is owned by UID 1000 on the host is also owned by UID 1000 within every container which has access to the file.

How to overcome problems:

Suppose you have an user www-data in two different containers. Since the only thing that matters in the end are the numbers, you must specify exactly the same UID and GID when generating the group and the user. Don't let the system assign these numbers automatically, because then the outcome is random (depends what's the next free number) and you end up with the problems you actually have.

BTW: use ls -n to show the numbers. You will see the numbers will be exactly the same everywhere, just the name-to-number mappings are different.

Additionally:

If the user(s) and group(s) get automatically generated during a package installation, you can map the group(s) and user(s) to different numbers afterwards.

But be warned: you must take care of the files which already belongs to that user and group manually, which means: find the files matching the old UID and GID and chown'ing them to the new UID and GID.

An example how this remapping can be done is HERE.

Did you ever fix this problem?

Hi

Not really an issue, but im having the exact same problem as you described in stack overflow with reference to this repository.

Did you ever fix it?
Would have commented on stack, but i dont not have enough reputation :-|

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.