I am running a rocker/rstudio docker container in Alpine Linux and would like to mount an existing folder under /home/myFolder
with some data for the container to read from and write to.
I tried mounting the folder as suggested in this post but I don't see the folder listed in RStudio. Here are a couple of commands I tried with no success. What am I doing wrong?
docker run -d -p 8787:8787 -v /home/myFolder:/myFolder/ rocker/rstudio
docker run -d -p 8787:8787 -v /home/myFolder rocker/rstudio
I will try to clarify what you are trying to do:
docker run -d -p 8787:8787 -v /home/myFolder:/myFolder/ rocker/rstudio
With the command above, you are mounting your host folder /home/myFolder
inside the docker container in folder /myFolder/
. To see if your folder was mounted inside the container try:
docker exec -it <name-of-the-container> bash
ls -la /myFolder
The other thing that you are trying to do:
docker run -d -p 8787:8787 -v /home/myFolder rocker/rstudio
is create a volume, or use a already existing volume and attach it to the container. While bind mounts are dependent on the directory structure of the host machine, volumes are completely managed by Docker