|
2 | 2 |
|
3 | 3 | import com.github.dockerjava.api.NotFoundException; |
4 | 4 | import com.github.dockerjava.api.NotModifiedException; |
5 | | -import com.github.dockerjava.api.model.Bind; |
6 | | -import com.github.dockerjava.api.model.Capability; |
7 | | -import com.github.dockerjava.api.model.Device; |
8 | | -import com.github.dockerjava.api.model.Link; |
9 | | -import com.github.dockerjava.api.model.LxcConf; |
10 | | -import com.github.dockerjava.api.model.PortBinding; |
11 | | -import com.github.dockerjava.api.model.Ports; |
12 | | -import com.github.dockerjava.api.model.RestartPolicy; |
13 | | -import com.github.dockerjava.api.model.VolumesFrom; |
14 | 5 |
|
15 | 6 | /** |
16 | 7 | * Start a container. |
17 | | - * |
18 | | - * TODO: Almost all methods are deprecated as they have corresponding siblings in {@link CreateContainerCmd} now. |
| 8 | + * |
19 | 9 | */ |
20 | 10 | public interface StartContainerCmd extends DockerCmd<Void> { |
21 | 11 |
|
22 | | - public static interface Exec extends DockerCmdExec<StartContainerCmd, Void> { |
23 | | - } |
| 12 | + public static interface Exec extends DockerCmdExec<StartContainerCmd, Void> { |
| 13 | + } |
24 | 14 |
|
25 | | - /** |
26 | | - * @throws NotFoundException |
27 | | - * No such container |
28 | | - * @throws NotModifiedException |
29 | | - * Container already started |
30 | | - */ |
31 | | - @Override |
32 | | - public Void exec() throws NotFoundException, NotModifiedException; |
| 15 | + String getContainerId(); |
33 | 16 |
|
34 | | - public Bind[] getBinds(); |
35 | | - |
36 | | - public Capability[] getCapAdd(); |
37 | | - |
38 | | - public Capability[] getCapDrop(); |
39 | | - |
40 | | - public String getContainerId(); |
41 | | - |
42 | | - public Device[] getDevices(); |
43 | | - |
44 | | - public String[] getDns(); |
45 | | - |
46 | | - public String[] getDnsSearch(); |
47 | | - |
48 | | - public String[] getExtraHosts(); |
49 | | - |
50 | | - public Link[] getLinks(); |
51 | | - |
52 | | - public LxcConf[] getLxcConf(); |
53 | | - |
54 | | - public String getNetworkMode(); |
55 | | - |
56 | | - public Ports getPortBindings(); |
57 | | - |
58 | | - public RestartPolicy getRestartPolicy(); |
59 | | - |
60 | | - public VolumesFrom[] getVolumesFrom(); |
61 | | - |
62 | | - public Boolean isPrivileged(); |
63 | | - |
64 | | - public Boolean isPublishAllPorts(); |
65 | | - |
66 | | - @Deprecated |
67 | | - public StartContainerCmd withBinds(Bind... binds); |
68 | | - |
69 | | - /** |
70 | | - * Add linux <a |
71 | | - * href="http://man7.org/linux/man-pages/man7/capabilities.7.html">kernel |
72 | | - * capability</a> to the container. For example: adding {@link Capability#MKNOD} |
73 | | - * allows the container to create special files using the 'mknod' command. |
74 | | - */ |
75 | | - @Deprecated |
76 | | - public StartContainerCmd withCapAdd(Capability... capAdd); |
77 | | - |
78 | | - /** |
79 | | - * Drop linux <a |
80 | | - * href="http://man7.org/linux/man-pages/man7/capabilities.7.html">kernel |
81 | | - * capability</a> from the container. For example: dropping {@link Capability#CHOWN} |
82 | | - * prevents the container from changing the owner of any files. |
83 | | - */ |
84 | | - @Deprecated |
85 | | - public StartContainerCmd withCapDrop(Capability... capDrop); |
86 | | - |
87 | | - @Deprecated |
88 | | - public StartContainerCmd withContainerId(String containerId); |
89 | | - |
90 | | - /** |
91 | | - * Add host devices to the container |
92 | | - */ |
93 | | - @Deprecated |
94 | | - public StartContainerCmd withDevices(Device... devices); |
95 | | - |
96 | | - /** |
97 | | - * Set custom DNS servers |
98 | | - */ |
99 | | - @Deprecated |
100 | | - public StartContainerCmd withDns(String... dns); |
101 | | - |
102 | | - /** |
103 | | - * Set custom DNS search domains |
104 | | - */ |
105 | | - @Deprecated |
106 | | - public StartContainerCmd withDnsSearch(String... dnsSearch); |
107 | | - |
108 | | - /** |
109 | | - * Add hostnames to /etc/hosts in the container |
110 | | - */ |
111 | | - @Deprecated |
112 | | - public StartContainerCmd withExtraHosts(String... extraHosts); |
113 | | - |
114 | | - /** |
115 | | - * Add link to another container. |
116 | | - */ |
117 | | - @Deprecated |
118 | | - public StartContainerCmd withLinks(Link... links); |
119 | | - |
120 | | - @Deprecated |
121 | | - public StartContainerCmd withLxcConf(LxcConf... lxcConf); |
122 | | - |
123 | | - /** |
124 | | - * Set the Network mode for the container |
125 | | - * <ul> |
126 | | - * <li>'bridge': creates a new network stack for the container on the docker |
127 | | - * bridge</li> |
128 | | - * <li>'none': no networking for this container</li> |
129 | | - * <li>'container:<name|id>': reuses another container network stack</li> |
130 | | - * <li>'host': use the host network stack inside the container. Note: the |
131 | | - * host mode gives the container full access to local system services such |
132 | | - * as D-bus and is therefore considered insecure.</li> |
133 | | - * </ul> |
134 | | - */ |
135 | | - @Deprecated |
136 | | - public StartContainerCmd withNetworkMode(String networkMode); |
137 | | - |
138 | | - /** |
139 | | - * Add one or more {@link PortBinding}s. |
140 | | - * This corresponds to the <code>--publish</code> (<code>-p</code>) |
141 | | - * option of the <code>docker run</code> CLI command. |
142 | | - */ |
143 | | - @Deprecated |
144 | | - public StartContainerCmd withPortBindings(PortBinding... portBindings); |
145 | | - |
146 | | - /** |
147 | | - * Add the port bindings that are contained in the given {@link Ports} |
148 | | - * object. |
149 | | - * |
150 | | - * @see #withPortBindings(PortBinding...) |
151 | | - */ |
152 | | - @Deprecated |
153 | | - public StartContainerCmd withPortBindings(Ports portBindings); |
154 | | - |
155 | | - @Deprecated |
156 | | - public StartContainerCmd withPrivileged(Boolean privileged); |
157 | | - |
158 | | - @Deprecated |
159 | | - public StartContainerCmd withPublishAllPorts(Boolean publishAllPorts); |
160 | | - |
161 | | - /** |
162 | | - * Set custom {@link RestartPolicy} for the container. Defaults to |
163 | | - * {@link RestartPolicy#noRestart()} |
164 | | - */ |
165 | | - @Deprecated |
166 | | - public StartContainerCmd withRestartPolicy(RestartPolicy restartPolicy); |
167 | | - |
168 | | - @Deprecated |
169 | | - public StartContainerCmd withVolumesFrom(VolumesFrom... volumesFrom); |
| 17 | + StartContainerCmd withContainerId(String containerId); |
170 | 18 |
|
| 19 | + /** |
| 20 | + * @throws NotFoundException |
| 21 | + * No such container |
| 22 | + * @throws NotModifiedException |
| 23 | + * Container already started |
| 24 | + */ |
| 25 | + @Override |
| 26 | + public Void exec() throws NotFoundException, NotModifiedException; |
171 | 27 | } |
0 commit comments