-
Notifications
You must be signed in to change notification settings - Fork 0
Home
As Dependencies this OSGi Plug-In requires com.google.gson, org.apache.httpcomponents.httpcore and org.apache.httpcomponents.httpclient
IDockerClient docker = DockerClientBuilder.builder().setUrl("http://localhost:2375").build();listContainers returns a list of containers. Default only running ones.
List<Container> containers = docker.listContainers(); // only running
List<Container> containers = docker.listContainers(ListContainersParam.allContainer()); // all containerscreateContainer creates a new Container with the given config.
ContainerCreation creation = docker.createContainer(ContainerConfig.builder().addCmd("/bin/bash").build());
ContainerCreation creation = docker.createContainer(ContainerConfig.builder().addCmd("/bin/bash").build(), "name for new Container");inspectContainer returns more information about a specific Container
ContainerInfo info = docker.inspectContainer("containerId");topContainer list running processes inside a Container like the Linux top command.
TopResults top = docker.topContainer("containerId", "aux");inspectContainerChanges inspects the changes of the Filesystem of the Container.
List<ContainerChanges> changes = docker.inspectContainerChanges("containerId");exportContainer Export the contents of a Container as a tarball.
docker.exportContainer("containerId");statContainer and statContainerStream gets the current resource usage of a Container.
With statContainer you get the stats once.
With statContainerStream you get the stats continuously. This is running in a seperated Thread. Keep in mind that if the container exists this method doesn't throw an error even if the container is not running (e.g stopContainer without removing it or startContainer without the autoremove option) and also if you stop a running container, which you have started without the autoremove option, on which you listen on the listening doesn't stop but the returned values aren't useful.
ContainerStats stats = docker.statContainer("containerId");
docker.statContainerStream("containerId", IContainerStatListener);resizeTTYContainer resizes the TTY for a container.
docker.resizeTTYContainer("containerId", 64, 256);startContainer starts a Container if it is not running.
docker.startContainer("containerId");stopContainer stops a Container if it is running.
If a time is given the Docker Engine waits the time in Seconds until it stops the Container.
docker.stopContainer("containerId");
docker.stopContainer("containerId", 1000) // time in millisecond
docker.stopContainer("containerid", 2, TimeUnit.SECONDS);restartContainer restarts a Container.
If a time is given the Docker Engine waits the time in Seconds until it restarts the Container.
docker.restartContainer("containerId");
docker.restartContainer("containerId", 1000) // time in millisecond
docker.restartContainer("containerid", 2, TimeUnit.SECONDS);killContainer killes a Container with the given id or name and with the given SIGNAL.
docker.topContainer("containerId", KillSignal.SIGTERM);updateContainer updates the HostConfig of a Container.
ContainerUpdate updateInfo = docker.updateContainer("containerId", HostConfig.builder().build());renameContianer renames a existing Container.
docker.renameContainer("containerId", "newName");pauseContainer pauses a Container with the given id or name.
docker.pauseContainer("containerId");unpauseContainer unpauses a Container with the given id or name.
docker.unpauseContainer("containerId");waitForContainer blocks until a container stops, then returns the exit code.
ContainerExit exit = docker.waitForContainer("containerId");removeContainer removes a Container with the given id or name.
docker.removeContainer("containerId", RemoveContainersParam.force());fileInfoContainer gets the Metadata of agiven file or folder inside a Container.
ContainerFileInfo info = docker.fileInfoContainer("containerId", "/path/to/file");archiveContainer gets an tar archive of a resource inside a Container.
docker.archiveContainer("containerId", "/path/to/file");extractToContainer extracts an archive (gzip, xz, bzip2) from the host to the container.
docker.extractToContainer("containerId", "/path/in/container", "/path/to/archive");deleteContainers delete all stopped Containers.
ContainerDeletedInfo info = docker.deleteContainers();runContainer creates a new Container with the given config and then starts the newly created Container. Attention! If the HostConfig.autoremove(true) option isn't used, this Method throws an error on the second run.
docker.runContianer(Containerconfig.builder().addCmd("/bin/bash").build());
docker.runContianer(Containerconfig.builder().addCmd("/bin/bash").build(), "containername");stopStatContainerStream stopps a previously started statContainerAsStream Thread.
docker.stopStatContainerStream("containerId");