diff --git a/buildSrc/src/main/groovy/io/deephaven/tools/docker/CombinedDockerRunTask.groovy b/buildSrc/src/main/groovy/io/deephaven/tools/docker/CombinedDockerRunTask.groovy index bc0322bc60f..6267c6ff978 100644 --- a/buildSrc/src/main/groovy/io/deephaven/tools/docker/CombinedDockerRunTask.groovy +++ b/buildSrc/src/main/groovy/io/deephaven/tools/docker/CombinedDockerRunTask.groovy @@ -112,6 +112,10 @@ class CombinedDockerRunTask extends AbstractDockerRemoteApiTask { } } + } finally { + if (containerId == null) { + return; + } // Copy output to internal output directory CopyArchiveFromContainerCmd copyCommand = dockerClient.copyArchiveFromContainerCmd(containerId, remotePath.get()) logger.quiet "Copying '${remotePath.get()}' from container with ID '${containerId}' to '${outputDir.get()}'." @@ -127,10 +131,6 @@ class CombinedDockerRunTask extends AbstractDockerRemoteApiTask { } finally { tarStream?.close() } - } finally { - if (containerId == null) { - return; - } RemoveContainerCmd removeCommand = dockerClient.removeContainerCmd(containerId) removeCommand.withRemoveVolumes(true) removeCommand.withForce(true)