Skip to content

Commit

Permalink
CHE-3761: Workaround illegal response from docker
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <mmorhun@codenvy.com>
  • Loading branch information
Mykola Morhun committed Jan 23, 2017
1 parent fdb0b25 commit 52f1e47
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -161,7 +161,14 @@ private void removeContainer(String containerId, String containerName) {
@VisibleForTesting
void cleanNetworks() {
try {
for (Network network : dockerConnector.getNetworks(GET_NETWORKS_PARAMS)) {
List<Network> customNetworks = dockerConnector.getNetworks(GET_NETWORKS_PARAMS);
// This workaround is added because of docker bug which returns null instead of empty list
// See https://github.com/docker/docker/issues/29946
if (customNetworks == null) {
return;
}

for (Network network : customNetworks) {
Matcher cheNetworkMatcher = CHE_NETWORK_PATTERN.matcher(network.getName());
if (cheNetworkMatcher.matches() && network.getContainers().isEmpty() && !additionalNetworks.contains(network.getName()) &&
!runtimes.hasRuntime(cheNetworkMatcher.group(WORKSPACE_ID_REGEX_GROUP))) {
Expand Down

0 comments on commit 52f1e47

Please sign in to comment.