Skip to content

Building a new Docker image manually

Chris Grandin edited this page Jun 1, 2021 · 16 revisions

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 docker/Dockerfile and/or the docker/install_packages.R files.

To add a latex package, add it to the docker/Dockerfile with the long list of others. To add an R packaghes, add it to the docker/install_packages.R.

Once satisfied, open a Powershell (Windows) or terminal and navigate to the csasdown/docker directory. Run the following command:

docker build . -t newid/csasdown

where newid is a unique id name for this image. If you use cgrandin/csasdown it will overwrite that image.

Once it is built, you follow the instructions in https://github.com/pbs-assess/csasdown/wiki/Compiling-your-document-in-a-Docker-container, except the run command will use your new image name:

docker run -d -p 8787:8787 --mount type=bind,source="$(pwd)",target=/home/rstudio newid/csasdown