Search in sources :

Example 6 with DockerException

use of com.spotify.docker.client.DockerException in project kie-wb-common by kiegroup.

the class DockerRuntimeManager method restart.

@Override
public void restart(RuntimeId runtimeId) throws RuntimeOperationException {
    DockerRuntime runtime = (DockerRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        docker.getDockerClient(runtime.getProviderId()).restartContainer(runtime.getId());
        refresh(runtimeId);
    } catch (DockerException | InterruptedException ex) {
        LOG.error("Error Restarting container: " + runtimeId.getId(), ex);
        throw new RuntimeOperationException("Error Restarting container: " + runtimeId.getId(), ex);
    }
}
Also used : DockerRuntime(org.guvnor.ala.docker.model.DockerRuntime) DockerException(com.spotify.docker.client.DockerException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 7 with DockerException

use of com.spotify.docker.client.DockerException in project kie-wb-common by kiegroup.

the class DockerRuntimeManager method start.

@Override
public void start(RuntimeId runtimeId) throws RuntimeOperationException {
    DockerRuntime runtime = (DockerRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        LOG.info("Starting container: " + runtimeId.getId());
        docker.getDockerClient(runtime.getProviderId()).startContainer(runtime.getId());
        refresh(runtimeId);
    } catch (DockerException | InterruptedException ex) {
        LOG.error("Error Starting container: " + runtimeId.getId(), ex);
        throw new RuntimeOperationException("Error Starting container: " + runtimeId.getId(), ex);
    }
}
Also used : DockerRuntime(org.guvnor.ala.docker.model.DockerRuntime) DockerException(com.spotify.docker.client.DockerException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Aggregations

DockerException (com.spotify.docker.client.DockerException)7 DockerRuntime (org.guvnor.ala.docker.model.DockerRuntime)6 RuntimeOperationException (org.guvnor.ala.exceptions.RuntimeOperationException)5 DockerRuntimeState (org.guvnor.ala.docker.model.DockerRuntimeState)2 DefaultDockerClient (com.spotify.docker.client.DefaultDockerClient)1 DockerCertificateException (com.spotify.docker.client.DockerCertificateException)1 ContainerConfig (com.spotify.docker.client.messages.ContainerConfig)1 ContainerCreation (com.spotify.docker.client.messages.ContainerCreation)1 ContainerInfo (com.spotify.docker.client.messages.ContainerInfo)1 ContainerState (com.spotify.docker.client.messages.ContainerState)1 HostConfig (com.spotify.docker.client.messages.HostConfig)1 Info (com.spotify.docker.client.messages.Info)1 PortBinding (com.spotify.docker.client.messages.PortBinding)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 DockerProvider (org.guvnor.ala.docker.model.DockerProvider)1 DockerRuntimeEndpoint (org.guvnor.ala.docker.model.DockerRuntimeEndpoint)1 DockerRuntimeInfo (org.guvnor.ala.docker.model.DockerRuntimeInfo)1