Search in sources :

Example 1 with IDockerProgressHandler

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

the class DockerConnection method pushImage.

@Override
public void pushImage(final String name, final IRegistryAccount info, final IDockerProgressHandler handler) throws DockerException, InterruptedException {
    try {
        final DockerClient client = dockerClientFactory.getClient(this.connectionSettings, info);
        final 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 | DockerCertificateException 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) DockerCertificateException(com.spotify.docker.client.exceptions.DockerCertificateException)

Example 2 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 id, final IDockerProgressHandler handler) throws DockerException, InterruptedException {
    try {
        DockerProgressHandler d = new DockerProgressHandler(handler);
        client.pull(id, 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)

Example 3 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 String name, final IDockerProgressHandler handler) throws DockerException, InterruptedException {
    try {
        DockerProgressHandler d = new DockerProgressHandler(handler);
        java.nio.file.Path p = FileSystems.getDefault().getPath(path.makeAbsolute().toOSString());
        String res = getClientCopy().build(p, name, 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)

Example 4 with IDockerProgressHandler

use of org.eclipse.linuxtools.docker.core.IDockerProgressHandler 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;
    }
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) IDockerProgressHandler(org.eclipse.linuxtools.docker.core.IDockerProgressHandler)

Example 5 with IDockerProgressHandler

use of org.eclipse.linuxtools.docker.core.IDockerProgressHandler 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;
    }
}
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