public class DockerClient extends Object
docker CLI.| Modifier and Type | Field and Description |
|---|---|
static Path |
DEFAULT_DOCKER_CLIENT
Default path to the docker executable.
|
| Constructor and Description |
|---|
DockerClient(Path dockerExecutable,
Map<String,String> dockerEnvironment)
Instantiates with a
docker executable and environment variables. |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isDefaultDockerInstalled()
Checks if Docker is installed on the user's system and accessible by running the default
docker command. |
static boolean |
isDockerInstalled(Path dockerExecutable)
Checks if Docker is installed on the user's system and accessible by running the given
docker executable. |
String |
load(ImageTarball imageTarball)
Loads an image tarball into the Docker daemon.
|
void |
save(ImageReference imageReference,
Path outputPath)
Saves an image tarball from the Docker daemon.
|
void |
tag(ImageReference originalImageReference,
ImageReference newImageReference)
Tags the image referenced by
originalImageReference with a new image reference newImageReference. |
public static final Path DEFAULT_DOCKER_CLIENT
public static boolean isDefaultDockerInstalled()
docker command.true if Docker is installed on the user's system and accessiblepublic static boolean isDockerInstalled(Path dockerExecutable)
docker executable.dockerExecutable - path to the executable to test runningtrue if Docker is installed on the user's system and accessiblepublic String load(ImageTarball imageTarball) throws InterruptedException, IOException
imageTarball - the built container tarball.docker.InterruptedException - if the 'docker load' process is interrupted.IOException - if streaming the blob to 'docker load' fails.public void save(ImageReference imageReference, Path outputPath) throws InterruptedException, IOException
imageReference - the image to saveoutputPath - the destination path to save the output tarballInterruptedException - if the 'docker save' process is interruptedIOException - if creating the tarball failspublic void tag(ImageReference originalImageReference, ImageReference newImageReference) throws IOException, InterruptedException
originalImageReference with a new image reference newImageReference.originalImageReference - the existing image reference on the Docker daemonnewImageReference - the new image referenceInterruptedException - if the 'docker tag' process is interrupted.IOException - if an I/O exception occurs or docker tag failedCopyright © 2019. All rights reserved.