Passing Cmd Line Arguments to your Rocker Container

Roel M. Hogervorst


Categories: r Tags: docker r variables

Quick thingy: For a Rocker (Docker containers with R installed) project I have to pass environmental variables. How do you pass that to the container? I save env variables for R to a .Renviron file. That way the R process can search for these vars and you do not have to hardcode them in the script.

Now saving it in a local .Renviron file has two effects: It is easy to pass to the container, you can run the script locally too.


docker build -t <name> .

docker run --env-file .Renviron <name>