Entry 1.2: Docker Homework - bcb420-2025/Chloe_Calica GitHub Wiki

Creating Own Docker Image

  1. Create your own Docker image built from the course base docker image.

    • was a bit confused at first because it said to create our own docker image which meant creating our own dockerfile as shown in lecture.
    • Since I wasn't familiar with how to create a docker image, I consulted the lecture slides from the first lecture on Docker (slides 43-46) as well as the Docker getting started guide outlined in Quercus.
    • I created the dockerfile in notepad following the example dockerfile from lecture.
      • Using the keyword FROM, I specified the base image which is our course docker image that I previously used in the Docker Setup in Entry 1
      • I then ommitted the line with RUN install2.r because I'm not installing additional R packages, but I did the retain the line for installing Bioconductor packages as seen in Step 2.
    • After creating the dockerfile, I then built it by using the following command in the Docker Desktop terminal (configured to my computer's Windows Powershell from Entry 1): docker build -t image_name:tag_name dir
      • -t is used to specify an optional tag name
      • dir represents the directory containing the dockerfile. I used . here since I already navigated to the directory that contained my dockerfile.
    • The image below shows the successful creation of the image in Docker Desktop after running the previous command. Successful Image Creation
  2. Add additional libraries to the image: DESeq2, pheatmap, enrichplot

    • Included in the dockerfile created above using the command RUN R -e 'BiocManager::install(package_names)
  3. Create a container with your Docker image.

    • To create the container, I used the following command as I did in Entry 1, but changing the image name to use.
    docker run -e PASSWORD=changeit --rm \ 
      -v ${PWD}:/home/rstudio/projects -p 8787:8787 \
      own_image
    
    • Below image shows the container being created Container of created image
    • Opened localhost:8787 in browser to make sure RStudio works. Also checked if the packages we wanted were installed. RStudio in Browser

Basic RNotebook

  1. Use your image to create a basic RNotebook that does the following:
    • create a 5 by 10 matrix of random integers

    Recall matrix function to create matrices and sample function to create random integers

    • define column names as cond1, cond2, cond3, cond4, cond5, ctrl1, ctrl2, ctrl3, ctrl4, ctrl5

    Recall colnames function

    • define row names as gene1, gene2, gene3 ...

    Recall rownames function

    • Compute the fold change for each gene.

    As a reminder, fold change formula is the mean of the conditions divided by mean of the controls.

  • Created a notebook called basic_RNotebook.Rmd with the above specified functions. Below image shows the final dataframe created by the notebook. Final Dataframe

  • Made the mistake of not putting the notebook inside projects/ so had to redo it.

  1. Push your Docker file and your basic RNotebook to your github repo