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
549 lines (403 loc) · 13.9 KB
/
Copy pathCreateContainerCmd.java
File metadata and controls
549 lines (403 loc) · 13.9 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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
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.AuthConfig;
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.HealthCheck;
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
AuthConfig getAuthConfig();
/**
* While using swarm classic, you can provide an optional auth config which will be used to pull images from a private registry,
* if the swarm node does not already have the docker image.
* Note: This option does not have any effect in normal docker
*
* @param authConfig The optional auth config
*/
CreateContainerCmd withAuthConfig(AuthConfig authConfig);
@CheckForNull
List<String> getAliases();
@Deprecated
@CheckForNull
Bind[] getBinds();
@Deprecated
CreateContainerCmd withBinds(Bind... binds);
@Deprecated
CreateContainerCmd withBinds(List<Bind> binds);
/**
* Add network-scoped alias for the container
*
* @param aliases on ore more aliases
*/
CreateContainerCmd withAliases(List<String> aliases);
/**
* Add network-scoped alias for the container
*
* @param aliases on ore more aliases
*/
CreateContainerCmd withAliases(String... aliases);
@CheckForNull
String[] getCmd();
CreateContainerCmd withCmd(String... cmd);
CreateContainerCmd withCmd(List<String> cmd);
@CheckForNull
HealthCheck getHealthcheck();
CreateContainerCmd withHealthcheck(HealthCheck healthCheck);
@CheckForNull
Boolean getArgsEscaped();
CreateContainerCmd withArgsEscaped(Boolean argsEscaped);
@CheckForNull
String getDomainName();
CreateContainerCmd withDomainName(String domainName);
@CheckForNull
String[] getEntrypoint();
CreateContainerCmd withEntrypoint(String... entrypoint);
CreateContainerCmd withEntrypoint(List<String> entrypoint);
@CheckForNull
String[] getEnv();
/**
* Adds environment-variables. NB: Not additive, i.e. in case of multiple calls to the method, only the most recent
* values will be injected. Prior env-variables will be deleted.
*
* @param env the String(s) to set as ENV in the container
*/
CreateContainerCmd withEnv(String... env);
/**
* Adds environment-variables. NB: Not additive, i.e. in case of multiple calls to the method, only the most recent
* values will be injected. Prior env-variables will be deleted.
*
* @param env the list of Strings to set as ENV in the container
*/
CreateContainerCmd withEnv(List<String> env);
@CheckForNull
ExposedPort[] getExposedPorts();
CreateContainerCmd withExposedPorts(List<ExposedPort> exposedPorts);
CreateContainerCmd withExposedPorts(ExposedPort... exposedPorts);
@CheckForNull
String getStopSignal();
CreateContainerCmd withStopSignal(String stopSignal);
@CheckForNull
Integer getStopTimeout();
CreateContainerCmd withStopTimeout(Integer stopTimeout);
@CheckForNull
String getHostName();
CreateContainerCmd withHostName(String hostName);
@CheckForNull
String getImage();
CreateContainerCmd withImage(String image);
@CheckForNull
String getIpv4Address();
CreateContainerCmd withIpv4Address(String ipv4Address);
@Deprecated
@CheckForNull
Link[] getLinks();
/**
* Add link to another container.
*/
@Deprecated
CreateContainerCmd withLinks(Link... links);
/**
* Add link to another container.
*/
@Deprecated
CreateContainerCmd withLinks(List<Link> links);
@CheckForNull
String getIpv6Address();
CreateContainerCmd withIpv6Address(String ipv6Address);
@CheckForNull
Map<String, String> getLabels();
CreateContainerCmd withLabels(Map<String, String> labels);
@CheckForNull
String getMacAddress();
CreateContainerCmd withMacAddress(String macAddress);
@Deprecated
@CheckForNull
Long getMemory();
@Deprecated
CreateContainerCmd withMemory(Long memory);
@Deprecated
@CheckForNull
Long getMemorySwap();
@Deprecated
CreateContainerCmd withMemorySwap(Long memorySwap);
@CheckForNull
String getName();
@Deprecated
@CheckForNull
String getNetworkMode();
/**
* 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>
*/
@Deprecated
CreateContainerCmd withNetworkMode(String networkMode);
@Deprecated
@CheckForNull
Ports getPortBindings();
/**
* 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.
*/
@Deprecated
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.
*/
@Deprecated
CreateContainerCmd withPortBindings(List<PortBinding> portBindings);
/**
* Add the port bindings that are contained in the given {@link Ports} object.
*
* @see #withPortBindings(PortBinding...)
*/
@Deprecated
CreateContainerCmd withPortBindings(Ports portBindings);
CreateContainerCmd withName(String name);
@CheckForNull
String[] getPortSpecs();
CreateContainerCmd withPortSpecs(String... portSpecs);
CreateContainerCmd withPortSpecs(List<String> portSpecs);
@Deprecated
@CheckForNull
Boolean getPrivileged();
@Deprecated
CreateContainerCmd withPrivileged(Boolean privileged);
@CheckForNull
String getUser();
CreateContainerCmd withUser(String user);
@CheckForNull
Volume[] getVolumes();
CreateContainerCmd withVolumes(Volume... volumes);
CreateContainerCmd withVolumes(List<Volume> volumes);
@Deprecated
@CheckForNull
VolumesFrom[] getVolumesFrom();
@Deprecated
CreateContainerCmd withVolumesFrom(VolumesFrom... volumesFrom);
@Deprecated
CreateContainerCmd withVolumesFrom(List<VolumesFrom> volumesFrom);
@CheckForNull
String getWorkingDir();
CreateContainerCmd withWorkingDir(String workingDir);
@CheckForNull
Boolean isAttachStderr();
CreateContainerCmd withAttachStderr(Boolean attachStderr);
@CheckForNull
Boolean isAttachStdin();
CreateContainerCmd withAttachStdin(Boolean attachStdin);
@CheckForNull
Boolean isAttachStdout();
CreateContainerCmd withAttachStdout(Boolean attachStdout);
@CheckForNull
Boolean isNetworkDisabled();
CreateContainerCmd withNetworkDisabled(Boolean disableNetwork);
@CheckForNull
Boolean isStdInOnce();
CreateContainerCmd withStdInOnce(Boolean stdInOnce);
@CheckForNull
Boolean isStdinOpen();
CreateContainerCmd withStdinOpen(Boolean stdinOpen);
@CheckForNull
Boolean isTty();
CreateContainerCmd withTty(Boolean tty);
@Deprecated
@CheckForNull
Boolean getPublishAllPorts();
@Deprecated
CreateContainerCmd withPublishAllPorts(Boolean publishAllPorts);
@CheckForNull
@Deprecated
String[] getExtraHosts();
/**
* Add hostnames to /etc/hosts in the container
*/
@Deprecated
CreateContainerCmd withExtraHosts(String... extraHosts);
/**
* Add hostnames to /etc/hosts in the container
*/
@Deprecated
CreateContainerCmd withExtraHosts(List<String> extraHosts);
@CheckForNull
@Deprecated
Capability[] getCapAdd();
/**
* 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.
*/
@Deprecated
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.
*/
@Deprecated
CreateContainerCmd withCapAdd(List<Capability> capAdd);
@CheckForNull
@Deprecated
Capability[] getCapDrop();
/**
* 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.
*/
@Deprecated
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.
*/
@Deprecated
CreateContainerCmd withCapDrop(List<Capability> capDrop);
@CheckForNull
List<String> getOnBuild();
CreateContainerCmd withOnBuild(List<String> onBuild);
@CheckForNull
HostConfig getHostConfig();
CreateContainerCmd withHostConfig(HostConfig hostConfig);
// The following methods are deprecated and should be set on {@link #getHostConfig()} instead.
// TODO remove in the next big release
@Deprecated
@CheckForNull
Integer getBlkioWeight();
@CheckForNull
@Deprecated
String getCgroupParent();
@Deprecated
@CheckForNull
Integer getCpuPeriod();
@Deprecated
@CheckForNull
Integer getCpuShares();
@Deprecated
@CheckForNull
String getCpusetCpus();
@Deprecated
@CheckForNull
String getCpusetMems();
@Deprecated
@CheckForNull
Device[] getDevices();
@Deprecated
@CheckForNull
String[] getDns();
@Deprecated
@CheckForNull
String[] getDnsSearch();
@Deprecated
@CheckForNull
LogConfig getLogConfig();
@Deprecated
@CheckForNull
LxcConf[] getLxcConf();
@Deprecated
@CheckForNull
Boolean getOomKillDisable();
@Deprecated
@CheckForNull
String getPidMode();
@Deprecated
@CheckForNull
Boolean getReadonlyRootfs();
@Deprecated
@CheckForNull
RestartPolicy getRestartPolicy();
@Deprecated
@CheckForNull
Ulimit[] getUlimits();
@Deprecated
CreateContainerCmd withBlkioWeight(Integer blkioWeight);
@Deprecated
CreateContainerCmd withCgroupParent(String cgroupParent);
@Deprecated
CreateContainerCmd withContainerIDFile(String containerIDFile);
@Deprecated
CreateContainerCmd withCpuPeriod(Integer cpuPeriod);
@Deprecated
CreateContainerCmd withCpuShares(Integer cpuShares);
@Deprecated
CreateContainerCmd withCpusetCpus(String cpusetCpus);
@Deprecated
CreateContainerCmd withCpusetMems(String cpusetMems);
@Deprecated
CreateContainerCmd withDevices(Device... devices);
/**
* Add host devices to the container
*/
@Deprecated
CreateContainerCmd withDevices(List<Device> devices);
/**
* Set custom DNS servers
*/
@Deprecated
CreateContainerCmd withDns(String... dns);
/**
* Set custom DNS servers
*/
@Deprecated
CreateContainerCmd withDns(List<String> dns);
/**
* Set custom DNS search domains
*/
@Deprecated
CreateContainerCmd withDnsSearch(String... dnsSearch);
/**
* Set custom DNS search domains
*/
@Deprecated
CreateContainerCmd withDnsSearch(List<String> dnsSearch);
@Deprecated
CreateContainerCmd withLogConfig(LogConfig logConfig);
@Deprecated
CreateContainerCmd withLxcConf(LxcConf... lxcConf);
@Deprecated
CreateContainerCmd withLxcConf(List<LxcConf> lxcConf);
@Deprecated
CreateContainerCmd withOomKillDisable(Boolean oomKillDisable);
/**
* Set the PID (Process) Namespace mode for the container, 'host': use the host's PID namespace inside the container
*/
@Deprecated
CreateContainerCmd withPidMode(String pidMode);
@Deprecated
CreateContainerCmd withReadonlyRootfs(Boolean readonlyRootfs);
/**
* Set custom {@link RestartPolicy} for the container. Defaults to {@link RestartPolicy#noRestart()}
*/
@Deprecated
CreateContainerCmd withRestartPolicy(RestartPolicy restartPolicy);
@Deprecated
CreateContainerCmd withUlimits(Ulimit... ulimits);
@Deprecated
CreateContainerCmd withUlimits(List<Ulimit> ulimits);
/**
* @throws NotFoundException No such container
* @throws ConflictException Named container already exists
*/
@Override
CreateContainerResponse exec() throws NotFoundException, ConflictException;
interface Exec extends DockerCmdSyncExec<CreateContainerCmd, CreateContainerResponse> {
}
}