Learn R Programming

AzureContainers (version 1.0.2)

call_docker: Call the docker commandline tool

Description

Call the docker commandline tool

Usage

call_docker(cmd = "", ...)

Arguments

cmd

The docker command line to execute.

...

Other arguments to pass to system2.

Value

By default, the return code from the docker binary. The return value will have an added attribute cmdline that contains the command line. This makes it easier to construct scripts that can be run outside R.

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.

See Also

system2, call_kubectl for the equivalent interface to the kubectl Kubernetes tool

docker_registry

Docker command line reference

Examples

Run this code
# NOT RUN {
# without any args, prints the docker help screen
call_docker()

# build an image
call_docker("build -t myimage .")

# list running containers
call_docker("container ls")

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

# }

Run the code above in your browser using DataLab