rstudio docker ubuntu file persistance problem

37 Views Asked by At

HI Docker/rocker experts. Your help would be appreciated. This is driving me nuts. I've tried a range of things from the web and stack overflow, to no avail.

Ubuntu system with docker desktop installed.

I can't create files in the mounted volume

The docker file is:

    FROM rocker/rstudio

MAINTAINER AN

RUN apt-get clean all && \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y \
            libhdf5-dev \
            libcurl4-gnutls-dev \
            libssl-dev \
            libxml2-dev \
            libpng-dev \
            libxt-dev \
        zlib1g-dev \
        libbz2-dev \
        liblzma-dev \
        libglpk40 \
        libgit2-dev \
        patch \         
            jags \
        && apt-get clean all && \
    apt-get purge && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN Rscript -e "install.packages(c('MixSIAR', 'ggplot2', 'NMOF', 'tidyverse', 'readxl' ));" 

WORKDIR /home/rstudio

The command it is run with is:

docker run --rm -ti -v "/home/username/IsoMixingModel/":"/home/rstudio/IsoMixingModel/" -p 8787:8787 -e PASSWORD=1234 rstudio:1.0

When I try to create a file within rstudio:

setwd("~/IsoMixingModel") df <- data.frame(cat=c(1,2,3,4)) write.csv(df, file = "./cat.csv") 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 './cat.csv': Permission denied

Suggestions?

Thanks

1

There are 1 best solutions below

0
On

for those curious.. I know exactly this config was working on my colleague's machine. However he was not using Docker desktop.

I uninstalled docker desktop:

https://docs.docker.com/desktop/uninstall/

Then I deleted the directory ~/.docker

Then I did a fresh docker install.

Then i re ran the docker build -- and it works perfectly.

I don't know what docker desktop was doing, but it seemed to be complicating things..