This is a test version of Biostars. For the public version, visit https://www.biostars.org.
R script in docker

Hello,

I am new in docker and try to run this tutorial: https://www.r-bloggers.com/2019/02/running-your-r-script-in-docker/ Through this tutorial, I try to run R script insider the container through the visual studio code. In the first part of tutorial when using the docker file that run the R script manually by source the script from inside the container using:

source("02_code/myScript.R")

It opens the R in terminal inside the visual studio code and the R couldn't see the path of the data, so I tried to change the current working directory using setwd(), it gave me an error that the working directory cannot be changed. I tried to see what is my current directory, I found that it is "/" that I don't know if it is the root or anything else.

I went through the next steps in the tutorial and run the whole R script automatically, the same error appears to me and the path of the input data can't be identified.

Please find the attached photos, the code doesn't run except open the R 4.2 terminal

Your help is appreciated.

Regards

r docker visual-studio-code

1 answer

This isn't a bioinformatics question. To access data that sits outside the container from within the container, you need to make it accessible within the container. See Docker's documentation on bind mounts.

Thank you for your answer, it helps me to solve this error.

Log in to answer this question.