use of org.eclipse.linuxtools.docker.core.DockerException in project linuxtools by eclipse.
the class DockerConnection method pushImage.
@Override
public void pushImage(final String name, final IDockerProgressHandler handler) throws DockerException, InterruptedException {
try {
DockerProgressHandler d = new DockerProgressHandler(handler);
client.push(name, d);
} catch (com.spotify.docker.client.exceptions.DockerRequestException e) {
throw new DockerException(e.message());
} catch (com.spotify.docker.client.exceptions.DockerException e) {
DockerException f = new DockerException(e);
throw f;
}
}
use of org.eclipse.linuxtools.docker.core.DockerException in project linuxtools by eclipse.
the class DockerConnection method copyContainer.
public InputStream copyContainer(final Closeable token, final String id, final String path) throws DockerException, InterruptedException {
InputStream stream;
DockerClient clientCopy = (DockerClient) token;
try {
stream = clientCopy.archiveContainer(id, path);
} catch (com.spotify.docker.client.exceptions.DockerException e) {
throw new DockerException(e.getMessage(), e.getCause());
}
return stream;
}
use of org.eclipse.linuxtools.docker.core.DockerException in project linuxtools by eclipse.
the class DockerConnection method pauseContainer.
@Override
public void pauseContainer(final String id) throws DockerException, InterruptedException {
try {
// pause container
client.pauseContainer(id);
// update container list
listContainers();
} catch (ContainerNotFoundException e) {
throw new DockerContainerNotFoundException(e);
} catch (com.spotify.docker.client.exceptions.DockerRequestException e) {
throw new DockerException(e.message());
} catch (com.spotify.docker.client.exceptions.DockerException e) {
throw new DockerException(e.getMessage(), e.getCause());
}
}
use of org.eclipse.linuxtools.docker.core.DockerException in project linuxtools by eclipse.
the class DockerConnection method buildImage.
/**
* Builds an {@link IDockerImage}
*
* @param path
* path to the build context
* @param name
* optional name and tag of the image to build
* @param handler
* progress handler
* @param buildOptions
* build options
* @return the id of the {@link IDockerImage} that was build
* @throws DockerException
* if building image failed
* @throws InterruptedException
* if the thread was interrupted
*/
// TODO: add this method in the public interface
public String buildImage(final IPath path, final String name, final IDockerProgressHandler handler, final Map<String, Object> buildOptions) throws DockerException, InterruptedException {
try {
final DockerProgressHandler d = new DockerProgressHandler(handler);
final java.nio.file.Path p = FileSystems.getDefault().getPath(path.makeAbsolute().toOSString());
String res = getClientCopy().build(p, name, d, getBuildParameters(buildOptions));
return res;
} catch (com.spotify.docker.client.exceptions.DockerRequestException e) {
throw new DockerException(e.message());
} catch (com.spotify.docker.client.exceptions.DockerException | IOException e) {
DockerException f = new DockerException(e);
throw f;
}
}
use of org.eclipse.linuxtools.docker.core.DockerException in project linuxtools by eclipse.
the class DockerConnection method attachLog.
public void attachLog(final Closeable token, final String id, final OutputStream out, final OutputStream err) throws DockerException, InterruptedException, IOException {
try {
LogStream stream = ((DockerClient) token).logs(id, LogsParam.follow(), LogsParam.stdout(), LogsParam.stderr());
stream.attach(out, err);
stream.close();
} catch (com.spotify.docker.client.exceptions.DockerException e) {
throw new DockerException(e.getMessage(), e.getCause());
}
}
Aggregations