Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not write csv file in rocker #434

Open
freshnemo opened this issue Jan 14, 2021 · 5 comments
Open

Can not write csv file in rocker #434

freshnemo opened this issue Jan 14, 2021 · 5 comments

Comments

@freshnemo
Copy link

Hi, when I install the rocker/tidyverse by the following commend
"sudo docker run -d --name kanglin_rstudio -v /internal/khsieh/:/internal/khsieh -e ROOT=TRUE -e PASSWORD=kanglin -p 7776:8787 rocker/tidyverse"

I can read the file but can not write a file, I got following alarms

"Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file '/internal/kangrstudio/all_dataset/CCLE/CCLE_RNAseq_genes_counts_20180929.gct.gz': No such file or directory"

Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'try.csv': Permission denied

How can I solve this issue?

@cboettig
Copy link
Member

When mapping volumes you will need to be sure user ID numbers match between host and container, see https://www.rocker-project.org/use/managing_users/.

@freshnemo
Copy link
Author

so the user id should b the same with host and container?

@eddelbuettel
Copy link
Member

Yes, ideally. Which makes it host dependent. On Ubuntu I have an alias (among several) setting 1000:1000 which is what I am on this machine. One can generalise it to user-lookup via id(1) etc but I didn't need this here:

alias dkrr='docker run --rm -ti -u1000:1000 -v$(pwd):/work -w /work'
alias dkrrr='docker run --rm -ti -v$(pwd):/work -w /work'
alias dkrrx='docker run --rm -it -u1000:1000 -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix'

@freshnemo
Copy link
Author

This is the current error I have
Commend
sudo docker run -d --name kanglin_rstudio -v /internal/khsieh/:/internal/khsieh --user khsieh -e PASSWORD=kanglin -p 7776:8787 rocker/tidyverse bash
Response
50534921e0857f6b00835474e193f18612aaf79e9151e4858eeb66cb05dd7cc8
docker: Error response from daemon: unable to find user khsieh: no matching entries in passwd file.

@eddelbuettel
Copy link
Member

eddelbuettel commented Jan 14, 2021

Simplify it:

edd@rob:~$ ls -l demo.csv                                                            # no file yet
ls: cannot access 'demo.csv': No such file or directory
edd@rob:~$ dkrr r-base Rscript -e 'write.csv(mtcars, file="demo.csv")'               # using alias from above
edd@rob:~$ ls -l demo.csv    
-rw-r--r-- 1 edd edd 1783 Jan 14 11:56 demo.csv
edd@rob:~$ head demo.csv 
"","mpg","cyl","disp","hp","drat","wt","qsec","vs","am","gear","carb"
"Mazda RX4",21,6,160,110,3.9,2.62,16.46,0,1,4,4
"Mazda RX4 Wag",21,6,160,110,3.9,2.875,17.02,0,1,4,4
"Datsun 710",22.8,4,108,93,3.85,2.32,18.61,1,1,4,1
"Hornet 4 Drive",21.4,6,258,110,3.08,3.215,19.44,1,0,3,1
"Hornet Sportabout",18.7,8,360,175,3.15,3.44,17.02,0,0,3,2
"Valiant",18.1,6,225,105,2.76,3.46,20.22,1,0,3,1
"Duster 360",14.3,8,360,245,3.21,3.57,15.84,0,0,3,4
"Merc 240D",24.4,4,146.7,62,3.69,3.19,20,1,0,4,2
"Merc 230",22.8,4,140.8,95,3.92,3.15,22.9,1,0,4,2
edd@rob:~$ 

Minimally working proof that yes, I can write a file in a container 'as me' so that I use later, as well as the inverse. You are setting yourself up for a more complicated situatoin and it is that situation ("where do I validate my password against?") where you fail. Carl pointed you to our general documentation for managing IDs which is still your best bet. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants