Coder Social home page Coder Social logo

Volume permission issue about shiny HOT 5 CLOSED

rocker-org avatar rocker-org commented on July 18, 2024
Volume permission issue

from shiny.

Comments (5)

antortjim avatar antortjim commented on July 18, 2024 6

I just added the shiny user to the docker group and made the shiny-server script the ENTRYPOINT
RUN adduser shiny docker
ENTRYPOINT shiny-server.sh

mount passing the --mount parameter to docker run using the Docker image produce by the built using the above Dockerfile. My app files are loaded into the container with the -v flag
docker run -dP \
--mount source=/host_data,target=/home/data \
-v /path/to/shinyapp:/srv/shiny-server/

This enables sharing of files between /home/data in the container and the /host_data dir in the host, while giving the shiny app permission to modify the files because the user running it, shiny, is now included in the docker group. I didn't need to modify any other permissions or specify a UID.

from shiny.

cboettig avatar cboettig commented on July 18, 2024 2

That's a good point, maybe @wch can weigh in. I don't see an easy way around this; basically you have to run the container as root so you can add the user docker to the group shiny first and then switch to the non-root user and run the container:

docker run -p 3838:3838 -d rocker/shiny bash -e "adduser docker shiny && su docker && shiny-server.sh"

Clearly that's a bit ugly. (also assumes your $UID is 1000, which is the UID of docker user which is already created on the system. Otherwise you have to add even more to the command to create a new linux user with the right permissions).

from shiny.

keqiang avatar keqiang commented on July 18, 2024 1

Thanks for your reply Carl!

I tried using the command you suggested by 'docker run -p 3838:3838 -d --name test -u $UID rocker/shiny' but the container won't start. When I get rid of the -d switch, it prompts the following:

chown: changing ownership of '/var/log/shiny-server': Operation not permitted
[2017-07-27 17:26:17.365] [INFO] shiny-server - Shiny Server v1.5.4.858 (Node.js v6.10.3)
[2017-07-27 17:26:17.371] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2017-07-27 17:26:17.429] [ERROR] shiny-server - Error loading config: The user 'undefined' does not have permissions to run applications as one of the users in 'shiny'. Please restart shiny-server as one of the users in 'shiny'. (/etc/shiny-server/shiny-server.conf:2:1)
[2017-07-27 17:26:17.430] [INFO] shiny-server - Shutting down worker processes

It seems the UID we specified is not in the 'shiny' group.

from shiny.

cboettig avatar cboettig commented on July 18, 2024

even if I start the docker container using user 'shiny', it doesn't help.

Docker doesn't care what the user name is, you need to make sure the UID in the container matches the UID of the host user. Do check out the wiki:

https://github.com/rocker-org/rocker/wiki/Sharing-files-with-host-machine

e.g. if you do docker run --rm -ti -u shiny rocker/shiny id you'll see this creates a user named shiny with UID 999. If your host system has the usual default single user, it's probably userid 1000, so these don't match. What you want to do is pass your UID number (e.g. 1000), not your user name:

if you run docker run --rm -ti -u $UID rocker/shiny id and you should get a user on the container with matching UID.

hope this helps,

Carl

from shiny.

keqiang avatar keqiang commented on July 18, 2024

Looks like rocker/shiny container will always create a user named shiny, whose uid is 999. I guess it is done by installing Shiny server. I don't know if this can be parameterized by using a Docker run variable to specify with which UID should the Shiny Server run apps, basically using the command parameter -u to substitute for the default 'shiny' user that to be created.

from shiny.

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.