Skip to content

Commit ecc2a19

Browse files
author
Marcus Linke
committed
Merge branch 'master' into netty
Conflicts: src/main/java/com/github/dockerjava/api/command/ExecStartCmd.java src/main/java/com/github/dockerjava/api/command/InspectContainerResponse.java src/main/java/com/github/dockerjava/core/command/ExecStartCmdImpl.java
2 parents f0dc0c7 + 47a9391 commit ecc2a19

File tree

256 files changed

+2824
-1299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+2824
-1299
lines changed

CHANGELOG.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
Change Log
22
===
3-
Latest SNAPSHOT (3.0.0-SNAPSHOT)
3+
4+
3.0.0-SNAPSHOT
45
---
56
Notes
67

7-
* The upcoming release will contain multiple API breaking changes therefore the major version switch
8+
* The upcoming release will contain multiple API breaking changes therefore the major version switch. It will supports a subset of v.1.21 of the docker remote API.
89

910
All changes
10-
11+
* [#393] (https://github.com/docker-java/docker-java/pull/392) Support ONBUILD instruction in Dockerfiles
12+
* [#392] (https://github.com/docker-java/docker-java/pull/392) Introduce InspectContainerResponse.Mounts
13+
* [#387] (https://github.com/docker-java/docker-java/pull/387) Make ProgressDetails attributes public
14+
* [#386] (https://github.com/docker-java/docker-java/pull/386) Basic http proxy configuration support
15+
* [#362] (https://github.com/docker-java/docker-java/pull/362) Deprecate "network" and enable "networks" stats (remote Docker API 1.21)
16+
* [#359] (https://github.com/docker-java/docker-java/pull/359) Fix performance issue of build command by adding bulk-read variant of InputStream.read()
1117
* [#357] (https://github.com/docker-java/docker-java/pull/357) Wait container command needs possibility to abort operation
18+
* [#347] (https://github.com/docker-java/docker-java/pull/347) Implementation of copy archive to/from container commands
1219
* [#313] (https://github.com/docker-java/docker-java/pull/313) Refactor primitive type fields to be of object type in JSON objects
1320

21+
v2.1.3
22+
---
23+
* [#387] (https://github.com/docker-java/docker-java/pull/387) Make ProgressDetails attributes public
24+
* [#386] (https://github.com/docker-java/docker-java/pull/386) Basic http proxy configuration support
25+
* [#362] (https://github.com/docker-java/docker-java/pull/362) Deprecate "network" and enable "networks" stats (remote Docker API 1.21)
26+
1427
v2.1.2
1528
---
1629
* [#350] (https://github.com/docker-java/docker-java/pull/350) Remove ServiceLoader logic

pom.xml

Lines changed: 59 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@
238238
</distributionManagement>
239239

240240
<build>
241-
<extensions>
242-
<extension>
243-
<groupId>kr.motd.maven</groupId>
244-
<artifactId>os-maven-plugin</artifactId>
245-
<version>1.2.3.Final</version>
246-
</extension>
247-
</extensions>
241+
<!-- <extensions> -->
242+
<!-- <extension> -->
243+
<!-- <groupId>kr.motd.maven</groupId> -->
244+
<!-- <artifactId>os-maven-plugin</artifactId> -->
245+
<!-- <version>1.2.3.Final</version> -->
246+
<!-- </extension> -->
247+
<!-- </extensions> -->
248248
<pluginManagement>
249249
<plugins>
250250

@@ -403,25 +403,6 @@
403403
<groupId>org.apache.maven.plugins</groupId>
404404
<artifactId>maven-source-plugin</artifactId>
405405
</plugin>
406-
<plugin>
407-
<groupId>org.codehaus.mojo</groupId>
408-
<artifactId>findbugs-maven-plugin</artifactId>
409-
<version>3.0.2</version>
410-
<configuration>
411-
<effort>Max</effort>
412-
<threshold>Low</threshold>
413-
<xmlOutput>true</xmlOutput>
414-
<!-- until all will be fixed -->
415-
<failOnError>false</failOnError>
416-
</configuration>
417-
<executions>
418-
<execution>
419-
<goals>
420-
<goal>check</goal>
421-
</goals>
422-
</execution>
423-
</executions>
424-
</plugin>
425406
</plugins>
426407
</build>
427408

@@ -450,6 +431,58 @@
450431
</plugins>
451432
</build>
452433
</profile>
434+
<profile>
435+
<id>docker-java-analyses</id>
436+
<activation>
437+
<activeByDefault>true</activeByDefault>
438+
</activation>
439+
<build>
440+
<plugins>
441+
<plugin>
442+
<artifactId>maven-checkstyle-plugin</artifactId>
443+
<version>2.17</version>
444+
<executions>
445+
<execution>
446+
<id>checkstyle</id>
447+
<phase>validate</phase>
448+
<goals>
449+
<goal>check</goal>
450+
</goals>
451+
</execution>
452+
</executions>
453+
<configuration>
454+
<encoding>UTF-8</encoding>
455+
<failOnViolation>true</failOnViolation>
456+
<logViolationsToConsole>true</logViolationsToConsole>
457+
<linkXRef>false</linkXRef>
458+
<!-- if some IDE has integration and requires other place, propose it -->
459+
<configLocation>
460+
src/test/resources/checkstyle/checkstyle-config.xml
461+
</configLocation>
462+
</configuration>
463+
</plugin>
464+
<plugin>
465+
<groupId>org.codehaus.mojo</groupId>
466+
<artifactId>findbugs-maven-plugin</artifactId>
467+
<version>3.0.2</version>
468+
<configuration>
469+
<effort>Max</effort>
470+
<threshold>Low</threshold>
471+
<xmlOutput>true</xmlOutput>
472+
<!-- until all will be fixed -->
473+
<failOnError>false</failOnError>
474+
</configuration>
475+
<executions>
476+
<execution>
477+
<goals>
478+
<goal>check</goal>
479+
</goals>
480+
</execution>
481+
</executions>
482+
</plugin>
483+
</plugins>
484+
</build>
485+
</profile>
453486
</profiles>
454487

455488
</project>

src/main/java/com/github/dockerjava/api/DockerClient.java

Lines changed: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
import java.io.IOException;
66
import java.io.InputStream;
77

8+
import javax.annotation.Nonnull;
9+
810
import com.github.dockerjava.api.command.AttachContainerCmd;
911
import com.github.dockerjava.api.command.AuthCmd;
1012
import com.github.dockerjava.api.command.BuildImageCmd;
1113
import com.github.dockerjava.api.command.CommitCmd;
1214
import com.github.dockerjava.api.command.ContainerDiffCmd;
15+
import com.github.dockerjava.api.command.CopyArchiveFromContainerCmd;
16+
import com.github.dockerjava.api.command.CopyArchiveToContainerCmd;
1317
import com.github.dockerjava.api.command.CopyFileFromContainerCmd;
1418
import com.github.dockerjava.api.command.CreateContainerCmd;
1519
import com.github.dockerjava.api.command.CreateImageCmd;
@@ -41,8 +45,10 @@
4145
import com.github.dockerjava.api.command.UnpauseContainerCmd;
4246
import com.github.dockerjava.api.command.VersionCmd;
4347
import com.github.dockerjava.api.command.WaitContainerCmd;
48+
import com.github.dockerjava.api.exception.DockerException;
4449
import com.github.dockerjava.api.model.AuthConfig;
4550
import com.github.dockerjava.api.model.Identifier;
51+
import com.github.dockerjava.core.RemoteApiVersion;
4652

4753
// https://godoc.org/github.com/fsouza/go-dockerclient
4854
public interface DockerClient extends Closeable {
@@ -64,31 +70,31 @@ public interface DockerClient extends Closeable {
6470
* * IMAGE API *
6571
*/
6672

67-
public PullImageCmd pullImageCmd(String repository);
73+
public PullImageCmd pullImageCmd(@Nonnull String repository);
6874

69-
public PushImageCmd pushImageCmd(String name);
75+
public PushImageCmd pushImageCmd(@Nonnull String name);
7076

71-
public PushImageCmd pushImageCmd(Identifier identifier);
77+
public PushImageCmd pushImageCmd(@Nonnull Identifier identifier);
7278

73-
public CreateImageCmd createImageCmd(String repository, InputStream imageStream);
79+
public CreateImageCmd createImageCmd(@Nonnull String repository, @Nonnull InputStream imageStream);
7480

75-
public SearchImagesCmd searchImagesCmd(String term);
81+
public SearchImagesCmd searchImagesCmd(@Nonnull String term);
7682

77-
public RemoveImageCmd removeImageCmd(String imageId);
83+
public RemoveImageCmd removeImageCmd(@Nonnull String imageId);
7884

7985
public ListImagesCmd listImagesCmd();
8086

81-
public InspectImageCmd inspectImageCmd(String imageId);
87+
public InspectImageCmd inspectImageCmd(@Nonnull String imageId);
8288

83-
public SaveImageCmd saveImageCmd(String name);
89+
public SaveImageCmd saveImageCmd(@Nonnull String name);
8490

8591
/**
8692
* * CONTAINER API *
8793
*/
8894

8995
public ListContainersCmd listContainersCmd();
9096

91-
public CreateContainerCmd createContainerCmd(String image);
97+
public CreateContainerCmd createContainerCmd(@Nonnull String image);
9298

9399
/**
94100
* Creates a new {@link StartContainerCmd} for the container with the given ID. The command can then be further
@@ -100,35 +106,69 @@ public interface DockerClient extends Closeable {
100106
* <p>
101107
* This command corresponds to the <code>/containers/{id}/start</code> endpoint of the Docker Remote API.
102108
*/
103-
public StartContainerCmd startContainerCmd(String containerId);
109+
public StartContainerCmd startContainerCmd(@Nonnull String containerId);
104110

105-
public ExecCreateCmd execCreateCmd(String containerId);
111+
public ExecCreateCmd execCreateCmd(@Nonnull String containerId);
106112

107-
public InspectContainerCmd inspectContainerCmd(String containerId);
113+
public InspectContainerCmd inspectContainerCmd(@Nonnull String containerId);
108114

109-
public RemoveContainerCmd removeContainerCmd(String containerId);
115+
public RemoveContainerCmd removeContainerCmd(@Nonnull String containerId);
110116

111-
public WaitContainerCmd waitContainerCmd(String containerId);
117+
public WaitContainerCmd waitContainerCmd(@Nonnull String containerId);
112118

113-
public AttachContainerCmd attachContainerCmd(String containerId);
119+
public AttachContainerCmd attachContainerCmd(@Nonnull String containerId);
114120

115-
public ExecStartCmd execStartCmd(String containerId);
121+
public ExecStartCmd execStartCmd(@Nonnull String containerId);
116122

117-
public InspectExecCmd inspectExecCmd(String execId);
123+
public InspectExecCmd inspectExecCmd(@Nonnull String execId);
118124

119-
public LogContainerCmd logContainerCmd(String containerId);
125+
public LogContainerCmd logContainerCmd(@Nonnull String containerId);
120126

121-
public CopyFileFromContainerCmd copyFileFromContainerCmd(String containerId, String resource);
127+
/**
128+
* Copy resource from container to local machine.
129+
*
130+
* @param containerId
131+
* id of the container
132+
* @param resource
133+
* path to container's resource
134+
* @return created command
135+
* @since {@link RemoteApiVersion#VERSION_1_20}
136+
*/
137+
public CopyArchiveFromContainerCmd copyArchiveFromContainerCmd(@Nonnull String containerId, @Nonnull String resource);
138+
139+
/**
140+
* Copy resource from container to local machine.
141+
*
142+
* @param containerId
143+
* id of the container
144+
* @param resource
145+
* path to container's resource
146+
* @return created command
147+
* @see #copyArchiveFromContainerCmd(String, String)
148+
* @deprecated since docker API version 1.20, replaced by {@link #copyArchiveFromContainerCmd(String, String)}
149+
*/
150+
@Deprecated
151+
public CopyFileFromContainerCmd copyFileFromContainerCmd(@Nonnull String containerId, @Nonnull String resource);
152+
153+
/**
154+
* Copy archive from local machine to remote container
155+
*
156+
* @param containerId
157+
* id of the container
158+
* @return created command
159+
* @since {@link RemoteApiVersion#VERSION_1_20}
160+
*/
161+
public CopyArchiveToContainerCmd copyArchiveToContainerCmd(@Nonnull String containerId);
122162

123-
public ContainerDiffCmd containerDiffCmd(String containerId);
163+
public ContainerDiffCmd containerDiffCmd(@Nonnull String containerId);
124164

125-
public StopContainerCmd stopContainerCmd(String containerId);
165+
public StopContainerCmd stopContainerCmd(@Nonnull String containerId);
126166

127-
public KillContainerCmd killContainerCmd(String containerId);
167+
public KillContainerCmd killContainerCmd(@Nonnull String containerId);
128168

129-
public RestartContainerCmd restartContainerCmd(String containerId);
169+
public RestartContainerCmd restartContainerCmd(@Nonnull String containerId);
130170

131-
public CommitCmd commitCmd(String containerId);
171+
public CommitCmd commitCmd(@Nonnull String containerId);
132172

133173
public BuildImageCmd buildImageCmd();
134174

@@ -146,7 +186,7 @@ public interface DockerClient extends Closeable {
146186

147187
public EventsCmd eventsCmd();
148188

149-
public StatsCmd statsCmd();
189+
public StatsCmd statsCmd(String containerId);
150190

151191
@Override
152192
public void close() throws IOException;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import javax.annotation.CheckForNull;
44
import javax.annotation.Nonnull;
55

6-
import com.github.dockerjava.api.UnauthorizedException;
6+
import com.github.dockerjava.api.exception.UnauthorizedException;
77
import com.github.dockerjava.api.model.AuthConfig;
88
import com.github.dockerjava.api.model.AuthResponse;
99

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.github.dockerjava.api.command;
22

3-
import com.github.dockerjava.api.model.AuthConfigurations;
4-
import com.github.dockerjava.api.model.BuildResponseItem;
3+
import java.io.File;
4+
import java.io.InputStream;
5+
import java.net.URI;
56

67
import javax.annotation.CheckForNull;
78
import javax.annotation.Nonnull;
89

9-
import java.io.File;
10-
import java.io.InputStream;
11-
import java.net.URI;
10+
import com.github.dockerjava.api.model.AuthConfigurations;
11+
import com.github.dockerjava.api.model.BuildResponseItem;
1212

1313
/**
1414
* Build an image from Dockerfile.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import javax.annotation.CheckForNull;
44
import javax.annotation.Nonnull;
55

6-
import com.github.dockerjava.api.NotFoundException;
6+
import com.github.dockerjava.api.exception.NotFoundException;
77
import com.github.dockerjava.api.model.ExposedPorts;
88
import com.github.dockerjava.api.model.Volumes;
99

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import javax.annotation.CheckForNull;
66
import javax.annotation.Nonnull;
77

8-
import com.github.dockerjava.api.DockerException;
9-
import com.github.dockerjava.api.InternalServerErrorException;
10-
import com.github.dockerjava.api.NotFoundException;
8+
import com.github.dockerjava.api.exception.DockerException;
9+
import com.github.dockerjava.api.exception.InternalServerErrorException;
10+
import com.github.dockerjava.api.exception.NotFoundException;
1111
import com.github.dockerjava.api.model.ChangeLog;
1212

1313
public interface ContainerDiffCmd extends SyncDockerCmd<List<ChangeLog>> {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.github.dockerjava.api.command;
2+
3+
import java.io.InputStream;
4+
5+
import javax.annotation.CheckForNull;
6+
import javax.annotation.Nonnull;
7+
8+
import com.github.dockerjava.api.exception.NotFoundException;
9+
10+
public interface CopyArchiveFromContainerCmd extends SyncDockerCmd<InputStream> {
11+
12+
@CheckForNull
13+
public String getContainerId();
14+
15+
@CheckForNull
16+
public String getHostPath();
17+
18+
@CheckForNull
19+
public String getResource();
20+
21+
public CopyArchiveFromContainerCmd withContainerId(@Nonnull String containerId);
22+
23+
public CopyArchiveFromContainerCmd withHostPath(String hostPath);
24+
25+
public CopyArchiveFromContainerCmd withResource(@Nonnull String resource);
26+
27+
/**
28+
* Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent connection leaks.
29+
*
30+
* @throws NotFoundException
31+
* No such container
32+
*/
33+
@Override
34+
public InputStream exec() throws NotFoundException;
35+
36+
public static interface Exec extends DockerCmdSyncExec<CopyArchiveFromContainerCmd, InputStream> {
37+
}
38+
}

0 commit comments

Comments
 (0)