22
33import com .github .dockerjava .api .ConflictException ;
44import com .github .dockerjava .api .NotFoundException ;
5+ import com .github .dockerjava .api .model .Bind ;
56import com .github .dockerjava .api .model .Capability ;
7+ import com .github .dockerjava .api .model .Device ;
68import com .github .dockerjava .api .model .ExposedPort ;
79import com .github .dockerjava .api .model .HostConfig ;
10+ import com .github .dockerjava .api .model .Link ;
11+ import com .github .dockerjava .api .model .LxcConf ;
12+ import com .github .dockerjava .api .model .PortBinding ;
13+ import com .github .dockerjava .api .model .Ports ;
14+ import com .github .dockerjava .api .model .RestartPolicy ;
815import com .github .dockerjava .api .model .Volume ;
916import com .github .dockerjava .api .model .VolumesFrom ;
1017
1118public interface CreateContainerCmd extends DockerCmd <CreateContainerResponse >{
1219
13- public CreateContainerCmd withName (String name );
14-
15- public String getName ();
16-
17- public CreateContainerCmd withExposedPorts (ExposedPort ... exposedPorts );
18-
19- public ExposedPort [] getExposedPorts ();
20+ public static interface Exec extends DockerCmdExec <CreateContainerCmd , CreateContainerResponse > {
21+ }
2022
21- public boolean isDisableNetwork ();
23+ /**
24+ * @throws NotFoundException No such container
25+ * @throws ConflictException Named container already exists
26+ */
27+ @ Override
28+ public CreateContainerResponse exec () throws NotFoundException ,
29+ ConflictException ;
2230
23- public String getWorkingDir ();
31+ public Bind [] getBinds ();
2432
25- public CreateContainerCmd withWorkingDir ( String workingDir );
33+ public Capability [] getCapAdd ( );
2634
27- public String getHostName ();
35+ public Capability [] getCapDrop ();
2836
29- public CreateContainerCmd withDisableNetwork ( boolean disableNetwork );
37+ public String [] getCmd ( );
3038
31- public CreateContainerCmd withHostName ( String hostName );
39+ public String getCpuset ( );
3240
33- public String [] getPortSpecs ();
41+ public int getCpuShares ();
3442
35- public CreateContainerCmd withPortSpecs ( String ... portSpecs );
43+ public Device [] getDevices ( );
3644
37- public String getUser ();
45+ public String [] getDns ();
46+
47+ public String [] getDnsSearch ();
3848
39- public CreateContainerCmd withUser ( String user );
49+ public String [] getEntrypoint ( );
4050
41- public boolean isTty ();
51+ public String [] getEnv ();
4252
43- public CreateContainerCmd withTty (boolean tty );
53+ public ExposedPort [] getExposedPorts ();
54+
55+ public String [] getExtraHosts ();
4456
45- public boolean isStdinOpen ();
57+ public HostConfig getHostConfig ();
4658
47- public CreateContainerCmd withStdinOpen ( boolean stdinOpen );
59+ public String getHostName ( );
4860
49- public boolean isStdInOnce ();
61+ public String getImage ();
5062
51- public CreateContainerCmd withStdInOnce (boolean stdInOnce );
63+ public Link [] getLinks ();
64+
65+ public LxcConf [] getLxcConf ();
5266
5367 public long getMemoryLimit ();
5468
55- public CreateContainerCmd withMemoryLimit (long memoryLimit );
56-
5769 public long getMemorySwap ();
5870
59- public CreateContainerCmd withMemorySwap (long memorySwap );
60-
61- public int getCpuShares ();
62-
63- public CreateContainerCmd withCpuShares (int cpuShares );
64-
65- public String getCpuset ();
71+ public String getName ();
72+
73+ public String getNetworkMode ();
74+
75+ public Ports getPortBindings ();
6676
67- public CreateContainerCmd withCpuset (String cpuset );
77+ public String [] getPortSpecs ();
78+
79+ public RestartPolicy getRestartPolicy ();
6880
69- public boolean isAttachStdin ();
81+ public String getUser ();
7082
71- public CreateContainerCmd withAttachStdin ( boolean attachStdin );
83+ public Volume [] getVolumes ( );
7284
73- public boolean isAttachStdout ();
85+ public VolumesFrom [] getVolumesFrom ();
7486
75- public CreateContainerCmd withAttachStdout ( boolean attachStdout );
87+ public String getWorkingDir ( );
7688
7789 public boolean isAttachStderr ();
7890
79- public CreateContainerCmd withAttachStderr (boolean attachStderr );
80-
81- public String [] getEnv ();
82-
83- public CreateContainerCmd withEnv (String ... env );
84-
85- public String [] getCmd ();
86-
87- public CreateContainerCmd withCmd (String ... cmd );
88-
89- public String [] getDns ();
91+ public boolean isAttachStdin ();
9092
91- public CreateContainerCmd withDns ( String ... dns );
93+ public boolean isAttachStdout ( );
9294
93- public String getImage ();
95+ public boolean isDisableNetwork ();
96+
97+ public Boolean isPrivileged ();
98+
99+ public Boolean isPublishAllPorts ();
94100
95- public CreateContainerCmd withImage ( String image );
101+ public boolean isStdInOnce ( );
96102
97- public Volume [] getVolumes ();
103+ public boolean isStdinOpen ();
98104
99- public CreateContainerCmd withVolumes ( Volume ... volumes );
105+ public boolean isTty ( );
100106
101- public VolumesFrom [] getVolumesFrom ( );
107+ public CreateContainerCmd withAttachStderr ( boolean attachStderr );
102108
103- public CreateContainerCmd withVolumesFrom ( VolumesFrom ... volumesFrom );
109+ public CreateContainerCmd withAttachStdin ( boolean attachStdin );
104110
105- public HostConfig getHostConfig ( );
111+ public CreateContainerCmd withAttachStdout ( boolean attachStdout );
106112
107- public CreateContainerCmd withHostConfig (HostConfig hostConfig );
108-
109- public Capability [] getCapAdd ();
113+ public CreateContainerCmd withBinds (Bind ... binds );
110114
111115 /**
112116 * Add linux <a
@@ -116,30 +120,121 @@ public interface CreateContainerCmd extends DockerCmd<CreateContainerResponse>{
116120 */
117121 public CreateContainerCmd withCapAdd (Capability ... capAdd );
118122
119- public Capability [] getCapDrop ();
120-
121123 /**
122124 * Drop linux <a
123125 * href="http://man7.org/linux/man-pages/man7/capabilities.7.html">kernel
124126 * capability</a> from the container. For example: dropping {@link Capability#CHOWN}
125127 * prevents the container from changing the owner of any files.
126128 */
127129 public CreateContainerCmd withCapDrop (Capability ... capDrop );
130+
131+ public CreateContainerCmd withCmd (String ... cmd );
132+
133+ public CreateContainerCmd withCpuset (String cpuset );
128134
135+ public CreateContainerCmd withCpuShares (int cpuShares );
129136
130- public String [] getEntrypoint ();
137+ /**
138+ * Add host devices to the container
139+ */
140+ public CreateContainerCmd withDevices (Device ... devices );
141+
142+ public CreateContainerCmd withDisableNetwork (boolean disableNetwork );
143+
144+ /**
145+ * Set custom DNS servers
146+ */
147+ public CreateContainerCmd withDns (String ... dns );
131148
149+ /**
150+ * Set custom DNS search domains
151+ */
152+ public CreateContainerCmd withDnsSearch (String ... dnsSearch );
153+
132154 public CreateContainerCmd withEntrypoint (String ... entrypoint );
155+
156+ public CreateContainerCmd withEnv (String ... env );
157+
158+ public CreateContainerCmd withExposedPorts (ExposedPort ... exposedPorts );
133159
134160 /**
135- * @throws NotFoundException No such container
136- * @throws ConflictException Named container already exists
161+ * Add hostnames to /etc/hosts in the container
137162 */
138- @ Override
139- public CreateContainerResponse exec () throws NotFoundException ,
140- ConflictException ;
163+ public CreateContainerCmd withExtraHosts (String ... extraHosts );
141164
142- public static interface Exec extends DockerCmdExec <CreateContainerCmd , CreateContainerResponse > {
143- }
165+ public CreateContainerCmd withHostConfig (HostConfig hostConfig );
166+
167+ public CreateContainerCmd withHostName (String hostName );
168+
169+ public CreateContainerCmd withImage (String image );
170+
171+ /**
172+ * Add link to another container.
173+ */
174+ public CreateContainerCmd withLinks (Link ... links );
175+
176+ public CreateContainerCmd withLxcConf (LxcConf ... lxcConf );
177+
178+ public CreateContainerCmd withMemoryLimit (long memoryLimit );
179+
180+ public CreateContainerCmd withMemorySwap (long memorySwap );
181+
182+ public CreateContainerCmd withName (String name );
183+
184+
185+ /**
186+ * Set the Network mode for the container
187+ * <ul>
188+ * <li>'bridge': creates a new network stack for the container on the docker
189+ * bridge</li>
190+ * <li>'none': no networking for this container</li>
191+ * <li>'container:<name|id>': reuses another container network stack</li>
192+ * <li>'host': use the host network stack inside the container. Note: the
193+ * host mode gives the container full access to local system services such
194+ * as D-bus and is therefore considered insecure.</li>
195+ * </ul>
196+ */
197+ public CreateContainerCmd withNetworkMode (String networkMode );
198+
199+ /**
200+ * Add one or more {@link PortBinding}s.
201+ * This corresponds to the <code>--publish</code> (<code>-p</code>)
202+ * option of the <code>docker run</code> CLI command.
203+ */
204+ public CreateContainerCmd withPortBindings (PortBinding ... portBindings );
205+
206+ /**
207+ * Add the port bindings that are contained in the given {@link Ports}
208+ * object.
209+ *
210+ * @see #withPortBindings(PortBinding...)
211+ */
212+ public CreateContainerCmd withPortBindings (Ports portBindings );
213+
214+ public CreateContainerCmd withPortSpecs (String ... portSpecs );
215+
216+ public CreateContainerCmd withPrivileged (boolean privileged );
217+
218+ public CreateContainerCmd withPublishAllPorts (boolean publishAllPorts );
219+
220+ /**
221+ * Set custom {@link RestartPolicy} for the container. Defaults to
222+ * {@link RestartPolicy#noRestart()}
223+ */
224+ public CreateContainerCmd withRestartPolicy (RestartPolicy restartPolicy );
225+
226+ public CreateContainerCmd withStdInOnce (boolean stdInOnce );
227+
228+ public CreateContainerCmd withStdinOpen (boolean stdinOpen );
229+
230+ public CreateContainerCmd withTty (boolean tty );
231+
232+ public CreateContainerCmd withUser (String user );
233+
234+ public CreateContainerCmd withVolumes (Volume ... volumes );
235+
236+ public CreateContainerCmd withVolumesFrom (VolumesFrom ... volumesFrom );
237+
238+ public CreateContainerCmd withWorkingDir (String workingDir );
144239
145240}
0 commit comments