call_docker {AzureContainers}R Documentation

Call the docker commandline tool

Description

Call the docker commandline tool

Usage

call_docker(cmd = "", ..., echo = getOption("azure_containers_tool_echo",
  TRUE))

Arguments

cmd

The docker command. This should be a vector of individual docker arguments, but can also be a single commandline string. See below.

...

Other arguments to pass to processx::run.

echo

Whether to echo the output of the command to the console.

Details

This function calls the docker binary, which must be located in your search path. AzureContainers will search for the binary at package startup, and print a warning if it is not found.

The docker command should be specified as a vector of the individual arguments, which is what processx::run expects. If a single string is passed, for convenience and back-compatibility reasons call_docker will split it into arguments for you. This is prone to error, for example if you are working with pathnames that contain spaces, so it's strongly recommended to pass a vector of arguments as a general practice.

Value

A list with the following components:

The first four components are from processx::run; AzureContainers adds the last to make it easier to construct scripts that can be run outside R.

See Also

processx::run, call_docker_compose, call_kubectl for the equivalent interface to the kubectl Kubernetes tool

docker_registry

Docker command line reference

Examples

## Not run: 

# without any args, prints the docker help screen
call_docker()

# build an image: recommended usage
call_docker(c("build", "-t", "myimage", "."))

# alternative usage, will be split into individual arguments
call_docker("build -t myimage .")

# list running containers
call_docker(c("container", "ls"))

# prune unused containers and images
call_docker(c("container", "prune", "-f"))
call_docker(c("image", "prune", "-f"))


## End(Not run)

[Package AzureContainers version 1.3.2 Index]