Skip to content

H1: Docker

Veronica Chang edited this page Feb 10, 2023 · 1 revision

Objective

Learn how to create a Docker image

  • Create a Docker image built from the BCB420 base image.
  • Add the additional DESeq2 and pheatmap packages.
  • Build a container from the newly created image.
  • Use the container to do tasks in R.

Started: 2023-01-20 | Completed: 2023-01-20
Estimated time: 2 hrs | Actual time: 1.5 hrs

Procedure

  • Install Docker
  • Create a Container for the course
    • Clone my GitHub repo locally.
    • Create a new Dockerfile with touch Dockerfile and pasted the following into the file with TextEdit.
FROM risserlin/bcb420-base-image:winter2023

# Install DESeq2 from Bioconductor
RUN R -e "BiocManager::install('DESeq2')"

# Install pheatmap from CRAN
RUN install2.r \
    -d TRUE \
    -r 'https://cran.rstudio.com' \
    pheatmap
  • Build the container with:
    • docker build '/Veronica_Chang/HW_Docker'
    • The image was successfully created and was named sha256:5c4b5b059404570523046f73bfd769584b422da7ca9e9.
  • Run the container:
    • docker run -e PASSWORD=changeit \ -v "$(pwd)":/home/rstudio/projects \ -p 8787:8787 \ sha256:5c4b5b059404570523046f73bfd769584b422da7ca9e9
  • Create new RNotebook
    • Access localhost:8787.
    • Log into RStudio with the above credentials.
    • Create an RNotebook and complete the assigned tasks (i.e. create a 5 by 10 matrix with random integers; name the columns; name the rows; calculate the fold change for each gene).

Results

  • New image was successfully created and was named sha256:5c4b5b059404570523046f73bfd769584b422da7ca9e9.
  • I was able to see the new image running in the Docker desktop app.
  • I created a new RNotebook with code that completes the tasks for the assignment (found here)

Conclusion

This homework assignment was a good opportunity for me to learn how to create a new Docker image and container. I am more comfortable with working with Docker and this will definitely help me for future assignments and projects.

References

Docker. (2023). Get started. https://docs.docker.com/get-started/
Steipe, B., & Isserlin, R. (2022) Chapter 2 Installing R and RStudio https://bcb420-2023.github.io/R_basics/r-install.html#r_docker

Clone this wiki locally