Skip to content

Building a new Docker image manually

Chris Grandin edited this page Nov 3, 2021 · 16 revisions

Building the image

You're not really meant to change the Dockerfile and install_packages.R files in csasdown, but to make a copy of them and put them somewhere else where you make your changes. You will make a new, personal image which you then run. It won't be part of the csasdown image. Copy/paste the docker directory into another directory we will call myproj/docker where you can edit them.

Open the Linux shell (or Powershell) and navigate to the myproj/docker directory and made your changes to the Dockerfile and/or install_packages.R file, build the image:

docker build . --no-cache -t mydocker_username/myproj

If you are satisfied with your new image you can push it to your Docker Hub account if you want. This assumes you made an account with the user name mydocker_username. Docker knows the URL and will push directly to Docker Hub.

docker push mydocker_username/myproj

What you might want to edit and why

If you find that when using the docker image cgrandin/csasdown you always have some manual steps after like adding new LaTeX packages and installing new R packages, you may want to add those things to the docker image locally so that you don't have to repeat them each time you open the RStudio instance. To do that, edit the Dockerfile for additional LaTeX packages and the install_packages.R file for additional R packages. If the changes are worthy of passing along to other users we can add them directly to the cgrandin/csasdown image.