These exercises follow the material in the Docker section of Reproducible
R.
- Run R using a Docker container from Docker Hub
- Pull the Rocker R image for version 4.2.3 from Docker Hub
- Confirm that this image is available on your computer
- Launch a container from this image
- HINT: is the -i and -t flags in the docker run command to run R
interactively in container
- execute R code from within the container
- Customize the Rocker R Docker image
Make a Dockerfile that contains R version 4.2.3, the CRAN
packages dplyr and ggplot2, the Bioconductor packages DESeq2 and
rtracklayer, and the conda package samtools.
- HINT: Make sure you install BiocManager from CRAN so that you can
install Bioconductor packages and also install Herper so that you can
install samtools
Build an image using this Dockerfile
Launch a container with this image with a volume from your local
computer mounted
Confirm that the container is running
Confirm that you can see the files in the mounted folder
- HINT: The R Rocker image does not set the working directory. You
need to mount the local directory somewhere within the docker image and
then navigate to that location from R to see those files. I recommend
mounting your local directory to ‘/home/local_data’ within that
container’s file system (this folder will automatically be made in
container)
- HINT #2: you can also use the ‘docker exec’ command from a separate
terminal tab to run a command within a container. You can type ‘docker
exec IMAGEID ls’ to list the file system.
make a plot from the ‘mtcars’ data set shows the relationship
between weight (wt) and miles per gallon (mpg) that comes with R and
save to your computer
- HINT: this table is available as a variable called ‘mtcars’
confirm that samtools is installed
push this image to Docker Hub