Skip to content

Commit 6f00250

Browse files
author
Pedro Cardoso
committed
Reverts create container cmd regression.
Summary: - Adds Memory and MemorySwap related methods to CreateContainerCmd interface and related interface. This was done so that the test-containers project can bump it's docker-java dependency for support to the latest docker version. See testcontainers/testcontainers-java#1340 for more. Note that this commit is a continuation of #1203, wherein I failed to see that these two methods were not reverted back.
1 parent c5c8932 commit 6f00250

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
126126

127127
CreateContainerCmd withMacAddress(String macAddress);
128128

129+
@Deprecated
130+
@CheckForNull
131+
Long getMemory();
132+
133+
@Deprecated
134+
CreateContainerCmd withMemory(Long memory);
135+
136+
@Deprecated
137+
@CheckForNull
138+
Long getMemorySwap();
139+
140+
@Deprecated
141+
CreateContainerCmd withMemorySwap(Long memorySwap);
142+
129143
@CheckForNull
130144
String getName();
131145

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,37 @@ public CreateContainerCmd withMacAddress(String macAddress) {
351351
return this;
352352
}
353353

354+
@Deprecated
355+
@Override
356+
@JsonIgnore
357+
public Long getMemory() {
358+
return hostConfig.getMemory();
359+
}
360+
361+
@Deprecated
362+
@Override
363+
public CreateContainerCmd withMemory(Long memory) {
364+
checkNotNull(memory, "memory was not specified");
365+
hostConfig.withMemory(memory);
366+
return this;
367+
}
368+
369+
@Deprecated
370+
@Override
371+
@JsonIgnore
372+
public Long getMemorySwap() {
373+
return hostConfig.getMemorySwap();
374+
}
375+
376+
@Deprecated
377+
@Override
378+
public CreateContainerCmd withMemorySwap(Long memorySwap) {
379+
checkNotNull(memorySwap, "memorySwap was not specified");
380+
hostConfig.withMemorySwap(memorySwap);
381+
return this;
382+
}
383+
384+
354385
@Override
355386
public String getName() {
356387
return name;

0 commit comments

Comments
 (0)