Skip to content

Commit e29e7da

Browse files
committed
Ignore container removal error.
1 parent 5e8cfc6 commit e29e7da

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/test/java/com/github/dockerjava/core/command/DockerfileFixture.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.dockerjava.core.command;
22

33
import com.github.dockerjava.api.DockerClient;
4+
import com.github.dockerjava.api.NotFoundException;
45
import org.slf4j.Logger;
56
import org.slf4j.LoggerFactory;
67

@@ -56,15 +57,19 @@ public void close() throws Exception {
5657

5758
if (containerId != null) {
5859
LOGGER.info("removing container {}", containerId);
59-
dockerClient
60-
.removeContainerCmd(containerId)
61-
.withForce() // stop too
62-
.exec();
60+
try {
61+
dockerClient
62+
.removeContainerCmd(containerId)
63+
.withForce() // stop too
64+
.exec();
65+
} catch (NotFoundException ignored) {
66+
LOGGER.info("ignoring {}", ignored.getMessage());
67+
}
6368
containerId = null;
6469
}
6570

6671
if (repository != null) {
67-
LOGGER.info("removing repostiory {}", repository);
72+
LOGGER.info("removing repository {}", repository);
6873
dockerClient
6974
.removeImageCmd(repository)
7075
.withForce()

0 commit comments

Comments
 (0)