Skip to content

3.0.x integration #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2018
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 @@ -23,6 +23,9 @@ public interface ExecCreateCmd extends SyncDockerCmd<ExecCreateCmdResponse> {
@CheckForNull
String getUser();

@CheckForNull
Boolean getPrivileged();

ExecCreateCmd withAttachStderr(Boolean attachStderr);

ExecCreateCmd withAttachStdin(Boolean attachStdin);
Expand All @@ -37,6 +40,8 @@ public interface ExecCreateCmd extends SyncDockerCmd<ExecCreateCmdResponse> {

ExecCreateCmd withUser(String user);

ExecCreateCmd withPrivileged(Boolean isPrivileged);

interface Exec extends DockerCmdSyncExec<ExecCreateCmd, ExecCreateCmdResponse> {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public class ExecCreateCmdImpl extends AbstrDockerCmd<ExecCreateCmd, ExecCreateC
@JsonProperty("Tty")
private Boolean tty;

/**
* @since 1.21
**/
@JsonProperty("Privileged")
private Boolean privileged;

/**
* @since {@link RemoteApiVersion#VERSION_1_19}
*/
Expand Down Expand Up @@ -83,6 +89,12 @@ public ExecCreateCmd withCmd(String... cmd) {
return this;
}

@Override
public ExecCreateCmd withPrivileged(Boolean privileged) {
this.privileged = privileged;
return this;
}

@Override
public String getContainerId() {
return containerId;
Expand All @@ -108,6 +120,11 @@ public Boolean hasTtyEnabled() {
return tty;
}

@Override
public Boolean getPrivileged() {
return privileged;
}

@Override
public String getUser() {
return user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private WebTarget writeMap(WebTarget webTarget, String name, Map<String, String>
if (value != null && !value.isEmpty()) {
try {
return webTarget.queryParam(name,
URLEncoder.encode(MAPPER.writeValueAsString(value), "UTF-8"));
URLEncoder.encode(MAPPER.writeValueAsString(value), "UTF-8").replaceAll("\\+", "%20"));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/github/dockerjava/cmd/BuildImageCmdIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ public void fromPrivateRegistry() throws Exception {
public void buildArgs() throws Exception {
File baseDir = fileFromBuildTestResource("buildArgs");

String imageId = dockerRule.getClient().buildImageCmd(baseDir).withNoCache(true).withBuildArg("testArg", "abc")
String imageId = dockerRule.getClient().buildImageCmd(baseDir).withNoCache(true).withBuildArg("testArg", "abc !@#$%^&*()_+")
.exec(new BuildImageResultCallback())
.awaitImageId();

InspectImageResponse inspectImageResponse = dockerRule.getClient().inspectImageCmd(imageId).exec();
assertThat(inspectImageResponse, not(nullValue()));
LOG.info("Image Inspect: {}", inspectImageResponse.toString());

assertThat(inspectImageResponse.getConfig().getLabels().get("test"), equalTo("abc"));
assertThat(inspectImageResponse.getConfig().getLabels().get("test"), equalTo("abc !@#$%^&*()_+"));
}

@Test
Expand Down