GithubHelp home page GithubHelp logo

Comments (4)

jpmens avatar jpmens commented on May 24, 2024

Thanks for your suggestion. Why do we need a dedicated user/group on the host system? I don't think this is required.

We'll gladly entertain a pull-request which implements this.

from docker-recorder.

marcopaganini avatar marcopaganini commented on May 24, 2024

from docker-recorder.

jpmens avatar jpmens commented on May 24, 2024

It is clearly visible that I'm not a Docker specialist, but I cannot imagine requring a host user/group.

In fact this page suggests it's not required, at least that's how I understand it:

FROM <base image>
RUN groupadd -g 999 appuser && \
    useradd -r -u 999 -g appuser appuser
USER appuser

From here onwards, our Recorder would run as user appuser, and I think that sounds like what you are asking for.

Are you able to test this, to make sure permissions on the data volume don't need changing?

That same link, btw, explains it is possible to voluntarily launch the container as non-root.

from docker-recorder.

marcopaganini avatar marcopaganini commented on May 24, 2024

Oh, I'm far from a docker specialist myself. :)

I don't believe your suggestion would work because it seems docker always mounts volumes as root.

See this example:

$ cat Dockerfile
FROM debian
RUN groupadd -g 999 appuser && \
    useradd -r -u 999 -g appuser appuser
USER appuser

$ docker build -t voltest:latest .
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM debian
 ---> 971452c94376
Step 2/3 : RUN groupadd -g 999 appuser &&     useradd -r -u 999 -g appuser appuser
 ---> Using cache
 ---> c0991713bdaf
Step 3/3 : USER appuser
 ---> Using cache
 ---> d325f2b5d689
Successfully built d325f2b5d689
Successfully tagged voltest:latest

$ docker volume create foobar
foobar

$ docker run -it --rm -v foobar:/foobar voltest
appuser@e1edf851f736:/$ ls -ltrd /foobar
drwxr-xr-x 2 root root 4096 Mar 12 04:03 /foobar

appuser@e1edf851f736:/$ id
uid=999(appuser) gid=999(appuser) groups=999(appuser)

As we can see, even when we specify a user, docker seems to always mount the volume as root (which is weird, but docker is weird.) The instructions I originally wrote work around this by mounting a directory on the host machine (which is not as nice as a clean volume), but require no modifications to Dockerfile.

If you're open to the idea of patches to the Dockerfile, we can create the appuser command above (with an ID in an env var, defaulting to 999) and upon execution chmod the mounted directory to that user, downgrade privileges and then run ot-recorder with that user.

Would that be an acceptable solution to you?

from docker-recorder.

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.