I am trying to create an RStudio instance and a Jupyter Notebook instance using docker-compose building an image. I can create these instances but the volumes mounted do not seem to be "persistent".
Below is the tree structure of my folders:
.
├── Docker
│ ├── docker-compose.yml
│ └── Dockerfile
└── R_and_Jupyter_scripts
└── files_already_there.txt
I would like:
1) The files_already_there.txt
to be available in my RStudio and Jupyter Notebook instance.
2) That any new file/script created from one of the two instances appears in the R_and_Jupyter_scripts
folder with read/write permissions. i.e: I created a textfile "output.txt" from the RStudio instance but when I check the path, here is where the file is saved:
sudo find / -name "output.txt"
/var/lib/docker/overlay2/821d3d087948309e3c489af29a5263e53e5f72627e903b4285a9597214412840/diff/home/maxence/output.txt
/var/lib/docker/overlay2/821d3d087948309e3c489af29a5263e53e5f72627e903b4285a9597214412840/merged/home/maxence/output.txt
Below is my current docker-compose.yml, can you identify what is wrong?
version: "3.5"
services:
rstudio:
environment:
- USER=maxence
- PASSWORD=password
image: "rocker/tidyverse:latest"
build:
context: ./
dockerfile: Dockerfile
volumes:
- /home/ec2-user/R_and_Jupyter_scripts:/var/lib/docker/
container_name: rstudio
ports:
- 8787:8787
jupyter:
image: 'jupyter/datascience-notebook:latest'
ports:
- 8888:8888
volumes:
- /home/ec2-user/R_and_Jupyter_scripts:/var/lib/docker/
container_name: jupyter
Thanks a lot.