JasonJWilliamsNY / dc_genomics_docker

Container development for Data Carpentry Genomics lessons
2 stars 2 forks source link

Adjust R-Studio home directory #4

Open JasonJWilliamsNY opened 5 years ago

JasonJWilliamsNY commented 5 years ago

Currently: `

getwd() [1] "/docker-persistant/dcuser/dc_genomics_r"`

Would be nice if that was /home/dcuser/dc_genomics_r. /home/dcuser is a symbolic link to /docker-persistant/dcuser, so need to find out how to fix this.

aortiz24 commented 5 years ago

I've tried to change the working directory, with setwd() and manually in Session ->Set Working Directory -> Choose Directory..., and it does not solve the problem. So I dug a little deeper. When you enter the docker container, you are in the /docker-persistant/dcuser directory. If you change where the docker container is set to initiate, that will adjust the RStudio home directory problem.

JasonJWilliamsNY commented 5 years ago

I haven't tried to fix this - The way the container starts now is the script initiate.sh is run so that inside container the dcuser account is created a well as a home folder. A fix would be to create dcuser on the VM itself (however this means someone trying to run the container on their own computer would have to know how to do this).

If you run the bash terminal in R you will see your location as /home/dcuser (same if you ssh into the shell). From what I have read, RStudio does not follow the symbolic link.

It's not a horrible thing, but would be nice if you do find a way to fix.

aortiz24 commented 5 years ago

After you connect to the docker container you are in the /home/dcuser directory. However, that is not where the RStudio working directory is set. The RStudio working directory is set to /docker-persistant. I have written code(below) that, if added to the beginning of the initiate.sh, could fix the problem (though I couldn't test it out since permission was denied).

docker container launches in the /home/dcuser directory

move up two directories to the home directory

cd ../..

make new directories

mkdir dcuser mkdir home mkdir docker_genomics_r

move the docker-persistant folder inside the dc_genomics_r directory

mv docker-persistant dc_genomics_r/

move the dc_genomics_r folder inside the dcuser directory

mv dc_genomics_r dcuser/

move the dcuser folder inside the home directory

mv dcuser home/

JasonJWilliamsNY commented 5 years ago

Hi @aortiz24 - you should be able to test your code - if you are working on the Atmosphere instance, you have sudo permission (your sudo password is the same as your docker password). You can also clone this repo and pull the docker image from docker hub (docker pull jasonjwilliamsny/dc_genomics:dev_1.8) to test things locally. I am not sure this code can work because docker-persistant is folder that should exist outside the docker container and is mounted when docker starts the dc_genomics container (using the -v (volume) option). It could perhaps be possible to do some thing like -v /docker-persistant:/home/dcuser (and some fixes in initiate.sh)but I have never tried!