Skip to content

Commit 52426bc

Browse files
Merge branch 'docker-java:master' into master
2 parents 5139fdb + 8253a99 commit 52426bc

41 files changed

Lines changed: 485 additions & 328 deletions

File tree

Some content is hidden

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

.ci/setup_docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if [[ -n $DOCKER_HOST ]]; then
2121
echo "
2222
[Service]
2323
ExecStart=
24-
ExecStart=/usr/bin/dockerd -H $DOCKER_HOST
24+
ExecStart=/usr/bin/dockerd -H $DOCKER_HOST -H unix:///var/run/docker.sock
2525
" | sudo tee -a /etc/systemd/system/docker.service.d/override.conf
2626

2727
sudo systemctl daemon-reload

.github/workflows/ci.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
include:
14-
- { name: "default" }
15-
- { name: "over TCP", dockerHost: "tcp://127.0.0.1:2375" }
16-
- { name: "Docker 18.06.3", dockerVersion: "18.06.3~ce~3-0~ubuntu" }
14+
- { name: "default", javaVersion: 8 }
15+
- { name: "default", javaVersion: 17 }
16+
- { name: "over TCP", dockerHost: "tcp://127.0.0.1:2375", javaVersion: 8 }
17+
- { name: "Docker 18.06.3", dockerVersion: "18.06.3~ce~3-0~ubuntu", javaVersion: 8 }
1718

1819
steps:
1920
- uses: actions/checkout@v2
20-
- name: Set up JDK 8
21+
- name: Set up JDK
2122
uses: actions/setup-java@v1
2223
with:
23-
java-version: 8
24+
java-version: ${{matrix.javaVersion}}
2425
- name: Configure Docker
2526
env:
2627
DOCKER_VERSION: ${{matrix.dockerVersion}}
@@ -29,14 +30,6 @@ jobs:
2930
- name: Build with Maven
3031
env:
3132
DOCKER_HOST: ${{matrix.dockerHost}}
32-
run: ./mvnw --no-transfer-progress verify
33-
- name: Aggregate test reports with ciMate
34-
if: always()
35-
continue-on-error: true
36-
env:
37-
CIMATE_PROJECT_ID: lodr9d83
38-
CIMATE_CI_KEY: "CI / ${{matrix.name}}"
3933
run: |
40-
wget -q https://get.cimate.io/release/linux/cimate
41-
chmod +x cimate
42-
./cimate "**/TEST-*.xml"
34+
[[ -z "$DOCKER_HOST" ]] && unset DOCKER_HOST
35+
./mvnw --no-transfer-progress verify

docker-java-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>org.projectlombok</groupId>
4040
<artifactId>lombok</artifactId>
41-
<version>1.18.18</version>
41+
<version>1.18.22</version>
4242
<scope>provided</scope>
4343
</dependency>
4444

docker-java-api/src/main/java/com/github/dockerjava/api/command/RestartContainerCmd.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ public interface RestartContainerCmd extends SyncDockerCmd<Void> {
2222

2323
RestartContainerCmd withContainerId(@Nonnull String containerId);
2424

25-
RestartContainerCmd withtTimeout(Integer timeout);
25+
/**
26+
* @deprecated wrong name, use {@link #withTimeout(Integer)}
27+
*/
28+
@Deprecated
29+
default RestartContainerCmd withtTimeout(Integer timeout) {
30+
return withTimeout(timeout);
31+
}
32+
33+
RestartContainerCmd withTimeout(Integer timeout);
2634

2735
/**
2836
* @throws NotFoundException

docker-java-api/src/main/java/com/github/dockerjava/api/model/HostConfig.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ public static HostConfig newHostConfig() {
292292
@JsonProperty("ConsoleSize")
293293
private List<Integer> consoleSize;
294294

295+
@JsonProperty("CgroupnsMode")
296+
private String cgroupnsMode;
297+
295298
@JsonIgnore
296299
public Bind[] getBinds() {
297300
return (binds == null) ? new Bind[0] : binds.getBinds();
@@ -1193,6 +1196,16 @@ public HostConfig withUsernsMode(String usernsMode) {
11931196
return this;
11941197
}
11951198

1199+
@CheckForNull
1200+
public String getCgroupnsMode() {
1201+
return cgroupnsMode;
1202+
}
1203+
1204+
public HostConfig withCgroupnsMode(String cgroupnsMode) {
1205+
this.cgroupnsMode = cgroupnsMode;
1206+
return this;
1207+
}
1208+
11961209
@CheckForNull
11971210
public Map<String, String> getSysctls() {
11981211
return sysctls;

docker-java-api/src/main/java/com/github/dockerjava/api/model/MountType.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ public enum MountType {
1414

1515
//@since 1.29
1616
@JsonProperty("tmpfs")
17-
TMPFS
17+
TMPFS,
18+
19+
//@since 1.40
20+
@JsonProperty("npipe")
21+
NPIPE
1822

1923
}

docker-java-core/src/main/java/com/github/dockerjava/core/DefaultDockerClientConfig.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,10 @@ public class DefaultDockerClientConfig implements Serializable, DockerClientConf
102102
}
103103

104104
private URI checkDockerHostScheme(URI dockerHost) {
105-
switch (dockerHost.getScheme()) {
106-
case "tcp":
107-
case "unix":
108-
case "npipe":
109-
return dockerHost;
110-
default:
111-
throw new DockerClientException("Unsupported protocol scheme found: '" + dockerHost);
105+
if (dockerHost == null) {
106+
throw new DockerClientException("'dockerHost' is null");
112107
}
108+
return dockerHost;
113109
}
114110

115111
private static Properties loadIncludedDockerProperties(Properties systemProperties) {

docker-java-core/src/main/java/com/github/dockerjava/core/command/CreateContainerCmdImpl.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.github.dockerjava.core.command;
22

3-
import com.fasterxml.jackson.annotation.JsonIgnore;
3+
import com.fasterxml.jackson.annotation.JsonAutoDetect;
44
import com.fasterxml.jackson.annotation.JsonProperty;
55
import com.github.dockerjava.api.command.CreateContainerCmd;
66
import com.github.dockerjava.api.command.CreateContainerResponse;
@@ -30,6 +30,13 @@
3030
* Creates a new container.
3131
* `/containers/create`
3232
*/
33+
@JsonAutoDetect(
34+
fieldVisibility = JsonAutoDetect.Visibility.NONE,
35+
setterVisibility = JsonAutoDetect.Visibility.NONE,
36+
getterVisibility = JsonAutoDetect.Visibility.NONE,
37+
isGetterVisibility = JsonAutoDetect.Visibility.NONE,
38+
creatorVisibility = JsonAutoDetect.Visibility.NONE
39+
)
3340
public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, CreateContainerResponse> implements
3441
CreateContainerCmd {
3542

@@ -122,13 +129,10 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
122129
@JsonProperty("NetworkingConfig")
123130
private NetworkingConfig networkingConfig;
124131

125-
@JsonIgnore
126132
private String ipv4Address = null;
127133

128-
@JsonIgnore
129134
private String ipv6Address = null;
130135

131-
@JsonIgnore
132136
private List<String> aliases = null;
133137

134138
private AuthConfig authConfig;
@@ -151,7 +155,6 @@ public CreateContainerCmd withAuthConfig(AuthConfig authConfig) {
151155
}
152156

153157
@Override
154-
@JsonIgnore
155158
public List<String> getAliases() {
156159
return aliases;
157160
}
@@ -256,7 +259,6 @@ public CreateContainerCmd withEnv(List<String> env) {
256259
}
257260

258261
@Override
259-
@JsonIgnore
260262
public ExposedPort[] getExposedPorts() {
261263
return exposedPorts.getExposedPorts();
262264
}
@@ -277,7 +279,6 @@ public CreateContainerCmd withExposedPorts(List<ExposedPort> exposedPorts) {
277279
/**
278280
* @see #stopSignal
279281
*/
280-
@JsonIgnore
281282
@Override
282283
public String getStopSignal() {
283284
return stopSignal;
@@ -326,7 +327,6 @@ public CreateContainerCmd withImage(String image) {
326327
}
327328

328329
@Override
329-
@JsonIgnore
330330
public Map<String, String> getLabels() {
331331
return labels;
332332
}
@@ -430,7 +430,6 @@ public CreateContainerCmd withAttachStdout(Boolean attachStdout) {
430430
}
431431

432432
@Override
433-
@JsonIgnore
434433
public Volume[] getVolumes() {
435434
return volumes.getVolumes();
436435
}

docker-java-core/src/main/java/com/github/dockerjava/core/command/RestartContainerCmdImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public RestartContainerCmd withContainerId(String containerId) {
4242
}
4343

4444
@Override
45-
public RestartContainerCmd withtTimeout(Integer timeout) {
45+
public RestartContainerCmd withTimeout(Integer timeout) {
4646
checkNotNull(timeout, "timeout was not specified");
4747
checkArgument(timeout >= 0, "timeout must be greater or equal 0");
4848
this.timeout = timeout;

docker-java-core/src/main/java/com/github/dockerjava/core/util/CompressArchiveUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ private static TarArchiveOutputStream buildTarStream(Path outputPath, boolean gZ
5454
outputStream = new GzipCompressorOutputStream(outputStream);
5555
}
5656
TarArchiveOutputStream tarArchiveOutputStream = new TarArchiveOutputStream(outputStream);
57-
tarArchiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
57+
tarArchiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
58+
tarArchiveOutputStream.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
5859
return tarArchiveOutputStream;
5960
}
6061

@@ -98,7 +99,8 @@ public static File archiveTARFiles(File base, Iterable<File> files, String archi
9899
tarFile.deleteOnExit();
99100
try (TarArchiveOutputStream tos = new TarArchiveOutputStream(new GZIPOutputStream(new BufferedOutputStream(
100101
new FileOutputStream(tarFile))))) {
101-
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
102+
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
103+
tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
102104
for (File file : files) {
103105
// relativize with method using Path otherwise method with File resolves the symlinks
104106
// and this is not want we want. If the file is a symlink, the relativized path should

0 commit comments

Comments
 (0)