Skip to content

Commit 9dea5ed

Browse files
committed
Merge pull request #2 from docker-java/master
Merge from upstream
2 parents 4217eeb + ca54f9c commit 9dea5ed

21 files changed

Lines changed: 284 additions & 81 deletions

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Change Log
22
===
33
Latest SNAPSHOT
44
---
5+
6+
* [#186](https://github.com/docker-java/docker-java/pull/186) Added withPull method to BuilImageCmd
7+
* [#185](https://github.com/docker-java/docker-java/pull/185) Introduce WrappedResponseInputStream to close underlying Response
58
* [#180](https://github.com/docker-java/docker-java/pull/180) Dockerfiles not called 'dockerfile'
69
* [#179](https://github.com/docker-java/docker-java/pull/179) Add support for cpuset in CreateContainerCmd
710
* [#170](https://github.com/docker-java/docker-java/pull/170) Allow to specify alternative files other than 'Dockerfile' for building images

src/main/java/com/github/dockerjava/api/command/AttachContainerCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public interface AttachContainerCmd extends DockerCmd<InputStream>{
5555
public AttachContainerCmd withLogs();
5656

5757
/**
58+
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
59+
* connection leaks.
60+
*
5861
* @throws NotFoundException No such container
5962
*/
6063
@Override

src/main/java/com/github/dockerjava/api/command/BuildImageCmd.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ public interface BuildImageCmd extends DockerCmd<BuildImageCmd.Response>{
2525
public boolean hasNoCacheEnabled();
2626

2727
public boolean hasRemoveEnabled();
28-
28+
2929
public boolean isQuiet();
30+
31+
public boolean hasPullEnabled();
3032

3133
public String getPathToDockerfile();
3234

@@ -50,6 +52,10 @@ public interface BuildImageCmd extends DockerCmd<BuildImageCmd.Response>{
5052

5153
public BuildImageCmd withQuiet(boolean quiet);
5254

55+
public BuildImageCmd withPull();
56+
57+
public BuildImageCmd withPull(boolean pull);
58+
5359
public BuildImageCmd withBuildAuthConfigs(AuthConfigurations authConfig);
5460

5561
public static interface Exec extends DockerCmdExec<BuildImageCmd, BuildImageCmd.Response> {

src/main/java/com/github/dockerjava/api/command/CopyFileFromContainerCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public interface CopyFileFromContainerCmd extends DockerCmd<InputStream> {
1919
public CopyFileFromContainerCmd withHostPath(String hostPath);
2020

2121
/**
22+
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
23+
* connection leaks.
24+
*
2225
* @throws NotFoundException No such container
2326
*/
2427
@Override

src/main/java/com/github/dockerjava/api/command/ExecStartCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public interface ExecStartCmd extends DockerCmd<InputStream> {
2323
public ExecStartCmd withTty();
2424

2525
/**
26+
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
27+
* connection leaks.
28+
*
2629
* @throws com.github.dockerjava.api.NotFoundException
2730
* No such exec instance
2831
*/

src/main/java/com/github/dockerjava/api/command/LogContainerCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public interface LogContainerCmd extends DockerCmd<InputStream>{
5656
public LogContainerCmd withTail(int tail);
5757

5858
/**
59+
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
60+
* connection leaks.
61+
*
5962
* @throws NotFoundException No such container
6063
*/
6164
@Override

src/main/java/com/github/dockerjava/api/command/PullImageCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,12 @@ public interface PullImageCmd extends DockerCmd<InputStream>{
2929

3030
public static interface Exec extends DockerCmdExec<PullImageCmd, InputStream> {
3131
}
32+
33+
/**
34+
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
35+
* connection leaks.
36+
*/
37+
@Override
38+
public InputStream exec();
3239

3340
}

src/main/java/com/github/dockerjava/api/command/SaveImageCmd.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public interface SaveImageCmd extends DockerCmd<InputStream>{
2121
public SaveImageCmd withTag(String tag);
2222

2323
/**
24+
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
25+
* connection leaks.
26+
*
2427
* @throws com.github.dockerjava.api.NotFoundException No such image
2528
*/
2629
public InputStream exec() throws NotFoundException;

src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import com.github.dockerjava.api.model.RestartPolicy;
1313

1414
/**
15-
* Start a container
15+
* Start a container.
16+
*
17+
* TODO: Almost all methods are deprecated as they have corresponding siblings in {@link CreateContainerCmd} now.
1618
*/
1719
public interface StartContainerCmd extends DockerCmd<Void> {
1820

@@ -48,13 +50,16 @@ public interface StartContainerCmd extends DockerCmd<Void> {
4850

4951
public Capability[] getCapDrop();
5052

53+
@Deprecated
5154
public StartContainerCmd withBinds(Bind... binds);
5255

5356
/**
5457
* Add link to another container.
5558
*/
59+
@Deprecated
5660
public StartContainerCmd withLinks(Link... links);
5761

62+
@Deprecated
5863
public StartContainerCmd withLxcConf(LxcConf... lxcConf);
5964

6065
/**
@@ -63,31 +68,39 @@ public interface StartContainerCmd extends DockerCmd<Void> {
6368
*
6469
* @see #withPortBindings(PortBinding...)
6570
*/
71+
@Deprecated
6672
public StartContainerCmd withPortBindings(Ports portBindings);
6773

6874
/**
6975
* Add one or more {@link PortBinding}s.
7076
* This corresponds to the <code>--publish</code> (<code>-p</code>)
7177
* option of the <code>docker run</code> CLI command.
7278
*/
79+
@Deprecated
7380
public StartContainerCmd withPortBindings(PortBinding... portBindings);
7481

82+
@Deprecated
7583
public StartContainerCmd withPrivileged(Boolean privileged);
7684

85+
@Deprecated
7786
public StartContainerCmd withPublishAllPorts(Boolean publishAllPorts);
7887

7988
/**
8089
* Set custom DNS servers
8190
*/
91+
@Deprecated
8292
public StartContainerCmd withDns(String... dns);
8393

8494
/**
8595
* Set custom DNS search domains
8696
*/
97+
@Deprecated
8798
public StartContainerCmd withDnsSearch(String... dnsSearch);
8899

100+
@Deprecated
89101
public StartContainerCmd withVolumesFrom(String volumesFrom);
90102

103+
@Deprecated
91104
public StartContainerCmd withContainerId(String containerId);
92105

93106
/**
@@ -102,22 +115,26 @@ public interface StartContainerCmd extends DockerCmd<Void> {
102115
* as D-bus and is therefore considered insecure.</li>
103116
* </ul>
104117
*/
118+
@Deprecated
105119
public StartContainerCmd withNetworkMode(String networkMode);
106120

107121
/**
108122
* Add host devices to the container
109123
*/
124+
@Deprecated
110125
public StartContainerCmd withDevices(Device... devices);
111126

112127
/**
113128
* Add hostnames to /etc/hosts in the container
114129
*/
130+
@Deprecated
115131
public StartContainerCmd withExtraHosts(String... extraHosts);
116132

117133
/**
118134
* Set custom {@link RestartPolicy} for the container. Defaults to
119135
* {@link RestartPolicy#noRestart()}
120136
*/
137+
@Deprecated
121138
public StartContainerCmd withRestartPolicy(RestartPolicy restartPolicy);
122139

123140
/**
@@ -126,6 +143,7 @@ public interface StartContainerCmd extends DockerCmd<Void> {
126143
* capability</a> to the container. For example: adding {@link Capability#MKNOD}
127144
* allows the container to create special files using the 'mknod' command.
128145
*/
146+
@Deprecated
129147
public StartContainerCmd withCapAdd(Capability... capAdd);
130148

131149
/**
@@ -134,6 +152,7 @@ public interface StartContainerCmd extends DockerCmd<Void> {
134152
* capability</a> from the container. For example: dropping {@link Capability#CHOWN}
135153
* prevents the container from changing the owner of any files.
136154
*/
155+
@Deprecated
137156
public StartContainerCmd withCapDrop(Capability... capDrop);
138157

139158
/**

src/main/java/com/github/dockerjava/core/command/BuildImageCmdImpl.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class BuildImageCmdImpl extends AbstrDockerCmd<BuildImageCmd, BuildImageC
2424
private boolean noCache;
2525
private boolean remove = true;
2626
private boolean quiet;
27+
private boolean pull;
28+
2729
private AuthConfigurations buildAuthConfigs;
2830
private File dockerFile;
2931
private File baseDirectory;
@@ -115,6 +117,11 @@ public boolean hasRemoveEnabled() {
115117
public boolean isQuiet() {
116118
return quiet;
117119
}
120+
121+
@Override
122+
public boolean hasPullEnabled() {
123+
return pull;
124+
}
118125

119126
@Override
120127
public String getPathToDockerfile() {
@@ -165,6 +172,17 @@ public BuildImageCmdImpl withQuiet(boolean quiet) {
165172
this.quiet = quiet;
166173
return this;
167174
}
175+
176+
@Override
177+
public BuildImageCmdImpl withPull() {
178+
return withPull(true);
179+
}
180+
181+
@Override
182+
public BuildImageCmdImpl withPull(boolean pull) {
183+
this.pull = pull;
184+
return this;
185+
}
168186

169187
@Override
170188
public BuildImageCmd withBuildAuthConfigs(AuthConfigurations authConfigs) {

0 commit comments

Comments
 (0)