Search in sources :

Example 6 with IDockerProgressHandler

use of org.eclipse.linuxtools.docker.core.IDockerProgressHandler in project linuxtools by eclipse.

the class DockerConnection method pullImage.

@Override
public void pullImage(final String imageId, final IRegistryAccount info, final IDockerProgressHandler handler) throws DockerException, InterruptedException, DockerCertificateException {
    try {
        final DockerClient client = dockerClientFactory.getClient(this.connectionSettings, info);
        final DockerProgressHandler d = new DockerProgressHandler(handler);
        client.pull(imageId, d);
        listImages();
    } 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;
    }
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) IDockerProgressHandler(org.eclipse.linuxtools.docker.core.IDockerProgressHandler) DockerClient(com.spotify.docker.client.DockerClient)

Example 7 with IDockerProgressHandler

use of org.eclipse.linuxtools.docker.core.IDockerProgressHandler in project linuxtools by eclipse.

the class DockerConnection method buildImage.

@Override
public String buildImage(final IPath path, final IDockerProgressHandler handler) 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, d, // $NON-NLS-1$ //$NON-NLS-2$
        BuildParam.create("forcerm", "true"));
        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;
    }
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) IDockerProgressHandler(org.eclipse.linuxtools.docker.core.IDockerProgressHandler) IOException(java.io.IOException)

Aggregations

DockerException (org.eclipse.linuxtools.docker.core.DockerException)7 IDockerProgressHandler (org.eclipse.linuxtools.docker.core.IDockerProgressHandler)7 IOException (java.io.IOException)3 DockerClient (com.spotify.docker.client.DockerClient)2 DockerCertificateException (com.spotify.docker.client.exceptions.DockerCertificateException)1