run | R Documentation |
Run a containerised command, and wait until finished
run(
container_id,
command,
args = NULL,
volumes = NULL,
workspace = NULL,
environment_variables = NULL,
debug = FALSE,
verbose = FALSE,
stdout = "|",
stderr = "|"
)
container_id |
The name of the container, usually the repository name on dockerhub. |
command |
Character scalar, the command to run. If you are
running |
args |
Character vector, arguments to the command. |
volumes |
Which volumes to be mounted. Format: a character vector, with each element containing the source path and container path concatenated with a ":". For example: |
workspace |
Which working directory to run the command in. |
environment_variables |
A character vector of environment variables. Format: |
debug |
If |
verbose |
Whether or not to print output |
stdout |
What to do with standard output of the command. Default ( |
stderr |
What to do with standard error of the command. Default ("|") means to include it as an item in the results list.
If it is the empty string ( |
if (test_docker_installation()) {
set_default_config(create_docker_config(), permanent = FALSE)
# running a command
run("alpine", "echo", c("hello"))
# mounting a folder
folder <- tempdir()
write("i'm a mounted file", paste0(folder, "/file.txt"))
run("alpine", "cat", c("/mounted_folder/file.txt"), volumes = paste0(folder, "/:/mounted_folder"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.