View source: R/run_auto_mount.R
run_auto_mount | R Documentation |
Similar to run()
, but automatically mounts files (and directories) so the
user doesn't have to keep track of volumes.
run_auto_mount(
container_id,
command,
args = NULL,
wd = NULL,
wd_in_container = 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. Any files or directories that should be mounted must be named "file" (see example). |
wd |
Local working directory to run command. If specified, the working directory will be mounted to the docker container. |
wd_in_container |
Working directory to run command in
the container. Defaults to the working directory mounted to the container
( |
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 ( |
The main difference to run()
is that the use of names for the args
; any
file (or directory) that should be mounted inside the container must be named
file
. The other elements (arguments) don't need to be named. Note that it
is fine to have multiple elements with the same name (file
).
This should generally work as long as the command accepts absolute paths
for file input. If that is not the case, use run()
instead and specify
paths and mounting manually.
List, formatted as output from processx::run()
if (test_docker_installation()) {
# Count the number of lines in the DESCRIPTION and LICENSE
# files of this package
run_auto_mount(
container_id = "alpine",
command = "wc",
args = c("-l",
file = system.file("DESCRIPTION", package = "babelwhale"),
file = system.file("LICENSE", package = "babelwhale")
)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.