GeezerVison is showing github.com — Add Init attribute in ContainerSpec (#1927) · rake5k/docker-java@3ea46f9
File tree
Expand file treeCollapse file tree
Open diff view settings
docker-java-api/src/main/java/com/github/dockerjava/api/model docker-java/src/test/java/com/github/dockerjava/cmd/swarm
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/ContainerSpec.java +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -161,6 +161,14 @@ public class ContainerSpec extends DockerObject implements Serializable { |
161 | 161 | @JsonProperty("Configs") |
162 | 162 | private List<ContainerSpecConfig> configs; |
163 | 163 |
|
| 164 | + /** |
| 165 | + * @since 1.38 |
| 166 | + * Run an init inside the container that forwards signals and reaps processes. |
| 167 | + * This field is omitted if empty, and the default (as configured on the daemon) is used. |
| 168 | + */ |
| 169 | + @JsonProperty("Init") |
| 170 | + private Boolean init; |
| 171 | + |
164 | 172 | /** |
165 | 173 | * @see #image |
166 | 174 | */ |
@@ -435,4 +443,13 @@ public ContainerSpec withConfigs(List<ContainerSpecConfig> configs) { |
435 | 443 | this.configs = configs; |
436 | 444 | return this; |
437 | 445 | } |
| 446 | + |
| 447 | + public Boolean getInit() { |
| 448 | + return init; |
| 449 | + } |
| 450 | + |
| 451 | + public ContainerSpec withInit(Boolean init) { |
| 452 | + this.init = init; |
| 453 | + return this; |
| 454 | + } |
438 | 455 | } |
Collapse file
Copy file name to clipboardExpand all lines: docker-java/src/test/java/com/github/dockerjava/cmd/swarm/UpdateSwarmServiceIT.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,7 @@ public void testUpdateServiceReplicate() throws Exception { |
27 | 27 | String networkId = dockerClient.createNetworkCmd().withName("networkname").withDriver("overlay") |
28 | 28 | .withIpam(new Network.Ipam().withDriver("default")).exec().getId(); |
29 | 29 | TaskSpec taskSpec = new TaskSpec().withContainerSpec( |
30 | | - new ContainerSpec().withImage("busybox").withArgs(Arrays.asList("sleep", "3600"))); |
| 30 | + new ContainerSpec().withImage("busybox").withArgs(Arrays.asList("sleep", "3600")).withInit(true)); |
31 | 31 | ServiceSpec serviceSpec = new ServiceSpec() |
32 | 32 | .withMode(new ServiceModeConfig().withReplicated(new ServiceReplicatedModeOptions().withReplicas(1))) |
33 | 33 | .withTaskTemplate(taskSpec) |
|