Search in sources :

Example 1 with DockerHostRunSetting

use of com.microsoft.azuretools.core.mvp.model.container.pojo.DockerHostRunSetting in project azure-tools-for-java by Microsoft.

the class DockerRuntime method cleanRuningContainer.

/**
 * clean running container.
 */
public synchronized void cleanRuningContainer(String key) throws DockerCertificateException, DockerException, InterruptedException {
    if (containerSettingMap.containsKey(key)) {
        String runningContainerId = (String) containerSettingMap.get(key).get(CONTAINER_ID_KEY);
        DockerHostRunSetting dataModel = (DockerHostRunSetting) containerSettingMap.get(key).get(DOCKER_HOST_RUN_SETTING_KEY);
        DockerClient docker = DockerUtil.getDockerClient(dataModel.getDockerHost(), dataModel.isTlsEnabled(), dataModel.getDockerCertPath());
        docker.stopContainer(runningContainerId, Constant.TIMEOUT_STOP_CONTAINER);
        docker.removeContainer(runningContainerId);
    }
    containerSettingMap.remove(key);
}
Also used : DockerHostRunSetting(com.microsoft.azuretools.core.mvp.model.container.pojo.DockerHostRunSetting) DockerClient(com.spotify.docker.client.DockerClient)

Aggregations

DockerHostRunSetting (com.microsoft.azuretools.core.mvp.model.container.pojo.DockerHostRunSetting)1 DockerClient (com.spotify.docker.client.DockerClient)1