Skip to content

Building a new Docker image manually

Chris Grandin edited this page Jul 8, 2022 · 16 revisions

Building the image

Only change the Dockerfile and install_packages.R files in csasdown if it is to be a global feature addition for all users.

For personal changes only 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 on your machine called myproj/docker for this wiki 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, and then build the image:

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

Testing the image and pushing it to DockerHub

Run a container from the image you just created by following the run command found in this wiki: https://github.com/pbs-assess/csasdown/wiki/Compiling-your-document-in-a-Docker-container

Test it thoroughly on your local machine. Once you are satisfied with your new image you can push it to your Docker Hub account if you want (it is recommended but not necessary). This assumes you made an account with the user name mydocker_username. Docker knows the URL and will push directly to DockerHub.

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 seem to 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 your RStudio container. 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.