forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveContainerCmdImpl.java
More file actions
69 lines (56 loc) · 1.76 KB
/
Copy pathRemoveContainerCmdImpl.java
File metadata and controls
69 lines (56 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.github.dockerjava.core.command;
import static com.google.common.base.Preconditions.checkNotNull;
import com.github.dockerjava.api.command.RemoveContainerCmd;
import com.github.dockerjava.api.exception.NotFoundException;
/**
* Remove a container.
*
* @param removeVolumes
* - true or false, Remove the volumes associated to the container. Defaults to false
* @param force
* - true or false, Removes the container even if it was running. Defaults to false
*/
public class RemoveContainerCmdImpl extends AbstrDockerCmd<RemoveContainerCmd, Void> implements RemoveContainerCmd {
private String containerId;
private Boolean removeVolumes, force;
public RemoveContainerCmdImpl(RemoveContainerCmd.Exec exec, String containerId) {
super(exec);
withContainerId(containerId);
}
@Override
public String getContainerId() {
return containerId;
}
@Override
public Boolean hasRemoveVolumesEnabled() {
return removeVolumes;
}
@Override
public Boolean hasForceEnabled() {
return force;
}
@Override
public RemoveContainerCmd withContainerId(String containerId) {
checkNotNull(containerId, "containerId was not specified");
this.containerId = containerId;
return this;
}
@Override
public RemoveContainerCmd withRemoveVolumes(Boolean removeVolumes) {
this.removeVolumes = removeVolumes;
return this;
}
@Override
public RemoveContainerCmd withForce(Boolean force) {
this.force = force;
return this;
}
/**
* @throws NotFoundException
* No such container
*/
@Override
public Void exec() throws NotFoundException {
return super.exec();
}
}