Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public interface CreateContainerCmd extends DockerCmd<CreateContainerResponse>{

public CreateContainerCmd withMemorySwap(long memorySwap);

public int getCpuShares();

public CreateContainerCmd withCpuShares(int cpuShares);

public boolean isAttachStdin();

public CreateContainerCmd withAttachStdin(boolean attachStdin);
Expand Down Expand Up @@ -96,10 +100,11 @@ public interface CreateContainerCmd extends DockerCmd<CreateContainerResponse>{
* @throws NotFoundException No such container
* @throws ConflictException Named container already exists
*/
@Override
public CreateContainerResponse exec() throws NotFoundException,
ConflictException;

public static interface Exec extends DockerCmdExec<CreateContainerCmd, CreateContainerResponse> {
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, C
@JsonProperty("User") private String user = "";
@JsonProperty("Memory") private long memoryLimit = 0;
@JsonProperty("MemorySwap") private long memorySwap = 0;
@JsonProperty("CpuShares") private int cpuShares = 0;
@JsonProperty("AttachStdin") private boolean attachStdin = false;
@JsonProperty("AttachStdout") private boolean attachStdout = false;
@JsonProperty("AttachStderr") private boolean attachStderr = false;
Expand Down Expand Up @@ -188,6 +189,16 @@ public CreateContainerCmdImpl withMemorySwap(long memorySwap) {
return this;
}

@Override
public int getCpuShares() {
return cpuShares;
}

@Override
public CreateContainerCmdImpl withCpuShares(int cpuShares) {
this.cpuShares = cpuShares;
return this;
}

@Override
public boolean isAttachStdin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public AttachContainerCmdExec(WebTarget baseResource) {
@Override
public InputStream exec(AttachContainerCmd command) {
WebTarget webResource = getBaseResource().path("/containers/{id}/attach")
.resolveTemplate("{id}", command.getContainerId())
.resolveTemplate("id", command.getContainerId())
.queryParam("logs", command.hasLogsEnabled() ? "1" : "0")
.queryParam("timestamps",command.hasTimestampsEnabled() ? "1" : "0")
// .queryParam("stdin", command.hasStdinEnabled() ? "1" : "0")
.queryParam("stdout", command.hasStdoutEnabled() ? "1" : "0")
.queryParam("stderr", command.hasStderrEnabled() ? "1" : "0")
.queryParam("follow", command.hasFollowStreamEnabled() ? "1" : "0");
.queryParam("stream", command.hasFollowStreamEnabled() ? "1" : "0");

LOGGER.trace("POST: {}", webResource);

Expand Down