AzureContainers/man/call_docker.Rd

65 строки
2.6 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ext_tools.R
\name{call_docker}
\alias{call_docker}
\title{Call the docker commandline tool}
\usage{
call_docker(cmd = "", ..., echo = getOption("azure_containers_tool_echo",
TRUE))
}
\arguments{
\item{cmd}{The docker command. This should be a \emph{vector} of individual docker arguments, but can also be a single commandline string. See below.}
\item{...}{Other arguments to pass to \link[processx:run]{processx::run}.}
\item{echo}{Whether to echo the output of the command to the console.}
}
\value{
A list with the following components:
\itemize{
\item \code{status}: The exit status of the docker tool. If this is \code{NA}, then the process was killed and had no exit status.
\item \code{stdout}: The standard output of the command, in a character scalar.
\item \code{stderr}: The standard error of the command, in a character scalar.
\item \code{timeout}: Whether the process was killed because of a timeout.
\item \code{cmdline}: The command line.
}
The first four components are from \code{processx::run}; AzureContainers adds the last to make it easier to construct scripts that can be run outside R.
}
\description{
Call the docker commandline tool
}
\details{
This function calls the \code{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 \code{processx::run} expects. If a single string is passed, for convenience and back-compatibility reasons \code{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.
}
\examples{
\dontrun{
# 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"))
}
}
\seealso{
\link[processx:run]{processx::run}, \link{call_docker_compose}, \link{call_kubectl} for the equivalent interface to the \code{kubectl} Kubernetes tool
\link{docker_registry}
\href{https://docs.docker.com/engine/reference/commandline/cli/}{Docker command line reference}
}