forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateContainerCmd.java
More file actions
456 lines (322 loc) · 11.5 KB
/
Copy pathCreateContainerCmd.java
File metadata and controls
456 lines (322 loc) · 11.5 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
package com.github.dockerjava.api.command;
import com.github.dockerjava.api.exception.ConflictException;
import com.github.dockerjava.api.exception.NotFoundException;
import com.github.dockerjava.api.model.Bind;
import com.github.dockerjava.api.model.Capability;
import com.github.dockerjava.api.model.Device;
import com.github.dockerjava.api.model.ExposedPort;
import com.github.dockerjava.api.model.HostConfig;
import com.github.dockerjava.api.model.Link;
import com.github.dockerjava.api.model.LogConfig;
import com.github.dockerjava.api.model.LxcConf;
import com.github.dockerjava.api.model.PortBinding;
import com.github.dockerjava.api.model.Ports;
import com.github.dockerjava.api.model.RestartPolicy;
import com.github.dockerjava.api.model.Ulimit;
import com.github.dockerjava.api.model.Volume;
import com.github.dockerjava.api.model.VolumesFrom;
import javax.annotation.CheckForNull;
import java.util.List;
import java.util.Map;
public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerResponse> {
@CheckForNull
List<String> getAliases();
@CheckForNull
Bind[] getBinds();
/**
* @since 1.19
*/
@CheckForNull
Integer getBlkioWeight();
@CheckForNull
Capability[] getCapAdd();
@CheckForNull
Capability[] getCapDrop();
@CheckForNull
String[] getCmd();
/**
* @since 1.19
*/
@CheckForNull
Integer getCpuPeriod();
@CheckForNull
String getCpusetCpus();
/**
* @since 1.19
*/
@CheckForNull
String getCpusetMems();
@CheckForNull
Integer getCpuShares();
@CheckForNull
Device[] getDevices();
@CheckForNull
String[] getDns();
@CheckForNull
String[] getDnsSearch();
@CheckForNull
String getDomainName();
@CheckForNull
String[] getEntrypoint();
@CheckForNull
String[] getEnv();
@CheckForNull
ExposedPort[] getExposedPorts();
@CheckForNull
String getStopSignal();
@CheckForNull
String[] getExtraHosts();
@CheckForNull
String getHostName();
@CheckForNull
String getImage();
@CheckForNull
String getIpv4Address();
@CheckForNull
String getIpv6Address();
@CheckForNull
Map<String, String> getLabels();
@CheckForNull
Link[] getLinks();
@CheckForNull
LogConfig getLogConfig();
@CheckForNull
LxcConf[] getLxcConf();
@CheckForNull
String getMacAddress();
@CheckForNull
Long getMemory();
@CheckForNull
Long getMemorySwap();
@CheckForNull
String getName();
@CheckForNull
String getNetworkMode();
@CheckForNull
Ports getPortBindings();
@CheckForNull
String[] getPortSpecs();
@CheckForNull
RestartPolicy getRestartPolicy();
@CheckForNull
Ulimit[] getUlimits();
@CheckForNull
String getUser();
@CheckForNull
Volume[] getVolumes();
@CheckForNull
VolumesFrom[] getVolumesFrom();
@CheckForNull
String getWorkingDir();
@CheckForNull
Boolean isAttachStderr();
@CheckForNull
Boolean isAttachStdin();
@CheckForNull
Boolean isAttachStdout();
@CheckForNull
Boolean isNetworkDisabled();
/**
* @since 1.19
*/
@CheckForNull
Boolean getOomKillDisable();
@CheckForNull
Boolean getPrivileged();
@CheckForNull
Boolean getPublishAllPorts();
@CheckForNull
Boolean getReadonlyRootfs();
@CheckForNull
Boolean isStdInOnce();
@CheckForNull
Boolean isStdinOpen();
@CheckForNull
String getPidMode();
@CheckForNull
HostConfig getHostConfig();
@CheckForNull
String getCgroupParent();
@CheckForNull
Boolean isTty();
/**
* Add network-scoped alias for the container
* @param aliases on ore more aliases
*/
CreateContainerCmd withAliases(String... aliases);
/**
* Add network-scoped alias for the container
* @param aliases on ore more aliases
*/
CreateContainerCmd withAliases(List<String> aliases);
CreateContainerCmd withAttachStderr(Boolean attachStderr);
CreateContainerCmd withAttachStdin(Boolean attachStdin);
CreateContainerCmd withAttachStdout(Boolean attachStdout);
CreateContainerCmd withBinds(Bind... binds);
CreateContainerCmd withBinds(List<Bind> binds);
/**
* @since 1.19
*/
CreateContainerCmd withBlkioWeight(Integer blkioWeight);
/**
* Add linux <a href="http://man7.org/linux/man-pages/man7/capabilities.7.html">kernel capability</a> to the container. For example:
* adding {@link Capability#MKNOD} allows the container to create special files using the 'mknod' command.
*/
CreateContainerCmd withCapAdd(Capability... capAdd);
/**
* Add linux <a href="http://man7.org/linux/man-pages/man7/capabilities.7.html">kernel capability</a> to the container. For example:
* adding {@link Capability#MKNOD} allows the container to create special files using the 'mknod' command.
*/
CreateContainerCmd withCapAdd(List<Capability> capAdd);
/**
* Drop linux <a href="http://man7.org/linux/man-pages/man7/capabilities.7.html">kernel capability</a> from the container. For example:
* dropping {@link Capability#CHOWN} prevents the container from changing the owner of any files.
*/
CreateContainerCmd withCapDrop(Capability... capDrop);
/**
* Drop linux <a href="http://man7.org/linux/man-pages/man7/capabilities.7.html">kernel capability</a> from the container. For example:
* dropping {@link Capability#CHOWN} prevents the container from changing the owner of any files.
*/
CreateContainerCmd withCapDrop(List<Capability> capDrop);
CreateContainerCmd withCmd(String... cmd);
CreateContainerCmd withCmd(List<String> cmd);
CreateContainerCmd withContainerIDFile(String containerIDFile);
/**
* @since 1.19
*/
CreateContainerCmd withCpuPeriod(Integer cpuPeriod);
CreateContainerCmd withCpusetCpus(String cpusetCpus);
/**
* @since 1.19
*/
CreateContainerCmd withCpusetMems(String cpusetMems);
CreateContainerCmd withCpuShares(Integer cpuShares);
/**
* Add host devices to the container
*/
CreateContainerCmd withDevices(Device... devices);
/**
* Add host devices to the container
*/
CreateContainerCmd withDevices(List<Device> devices);
/**
* Set custom DNS servers
*/
CreateContainerCmd withDns(String... dns);
/**
* Set custom DNS servers
*/
CreateContainerCmd withDns(List<String> dns);
/**
* Set custom DNS search domains
*/
CreateContainerCmd withDnsSearch(String... dnsSearch);
/**
* Set custom DNS search domains
*/
CreateContainerCmd withDnsSearch(List<String> dnsSearch);
CreateContainerCmd withDomainName(String domainName);
CreateContainerCmd withEntrypoint(String... entrypoint);
CreateContainerCmd withEntrypoint(List<String> entrypoint);
CreateContainerCmd withEnv(String... env);
CreateContainerCmd withEnv(List<String> env);
CreateContainerCmd withExposedPorts(ExposedPort... exposedPorts);
CreateContainerCmd withStopSignal(String stopSignal);
CreateContainerCmd withExposedPorts(List<ExposedPort> exposedPorts);
/**
* Add hostnames to /etc/hosts in the container
*/
CreateContainerCmd withExtraHosts(String... extraHosts);
/**
* Add hostnames to /etc/hosts in the container
*/
CreateContainerCmd withExtraHosts(List<String> extraHosts);
CreateContainerCmd withHostName(String hostName);
CreateContainerCmd withImage(String image);
CreateContainerCmd withIpv4Address(String ipv4Address);
CreateContainerCmd withIpv6Address(String ipv6Address);
CreateContainerCmd withLabels(Map<String, String> labels);
/**
* Add link to another container.
*/
CreateContainerCmd withLinks(Link... links);
/**
* Add link to another container.
*/
CreateContainerCmd withLinks(List<Link> links);
CreateContainerCmd withLogConfig(LogConfig logConfig);
CreateContainerCmd withLxcConf(LxcConf... lxcConf);
CreateContainerCmd withLxcConf(List<LxcConf> lxcConf);
CreateContainerCmd withMacAddress(String macAddress);
CreateContainerCmd withMemory(Long memory);
CreateContainerCmd withMemorySwap(Long memorySwap);
CreateContainerCmd withName(String name);
CreateContainerCmd withNetworkDisabled(Boolean disableNetwork);
/**
* Set the Network mode for the container
* <ul>
* <li>'bridge': creates a new network stack for the container on the docker bridge</li>
* <li>'none': no networking for this container</li>
* <li>'container:<name|id>': reuses another container network stack</li>
* <li>'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system
* services such as D-bus and is therefore considered insecure.</li>
* </ul>
*/
CreateContainerCmd withNetworkMode(String networkMode);
/**
* @since 1.19
*/
CreateContainerCmd withOomKillDisable(Boolean oomKillDisable);
/**
* Add one or more {@link PortBinding}s. This corresponds to the <code>--publish</code> (<code>-p</code>) option of the
* <code>docker run</code> CLI command.
*/
CreateContainerCmd withPortBindings(PortBinding... portBindings);
/**
* Add one or more {@link PortBinding}s. This corresponds to the <code>--publish</code> (<code>-p</code>) option of the
* <code>docker run</code> CLI command.
*/
CreateContainerCmd withPortBindings(List<PortBinding> portBindings);
/**
* Add the port bindings that are contained in the given {@link Ports} object.
*
* @see #withPortBindings(PortBinding...)
*/
CreateContainerCmd withPortBindings(Ports portBindings);
CreateContainerCmd withPortSpecs(String... portSpecs);
CreateContainerCmd withPortSpecs(List<String> portSpecs);
CreateContainerCmd withPrivileged(Boolean privileged);
CreateContainerCmd withPublishAllPorts(Boolean publishAllPorts);
CreateContainerCmd withReadonlyRootfs(Boolean readonlyRootfs);
/**
* Set custom {@link RestartPolicy} for the container. Defaults to {@link RestartPolicy#noRestart()}
*/
CreateContainerCmd withRestartPolicy(RestartPolicy restartPolicy);
CreateContainerCmd withStdInOnce(Boolean stdInOnce);
CreateContainerCmd withStdinOpen(Boolean stdinOpen);
CreateContainerCmd withTty(Boolean tty);
CreateContainerCmd withUlimits(Ulimit... ulimits);
CreateContainerCmd withUlimits(List<Ulimit> ulimits);
CreateContainerCmd withUser(String user);
CreateContainerCmd withVolumes(Volume... volumes);
CreateContainerCmd withVolumes(List<Volume> volumes);
CreateContainerCmd withVolumesFrom(VolumesFrom... volumesFrom);
CreateContainerCmd withVolumesFrom(List<VolumesFrom> volumesFrom);
CreateContainerCmd withWorkingDir(String workingDir);
CreateContainerCmd withCgroupParent(String cgroupParent);
/**
* Set the PID (Process) Namespace mode for the container, 'host': use the host's PID namespace inside the container
*/
CreateContainerCmd withPidMode(String pidMode);
CreateContainerCmd withHostConfig(HostConfig hostConfig);
/**
* @throws NotFoundException
* No such container
* @throws ConflictException
* Named container already exists
*/
@Override
CreateContainerResponse exec() throws NotFoundException, ConflictException;
interface Exec extends DockerCmdSyncExec<CreateContainerCmd, CreateContainerResponse> {
}
}