Skip to content

Commit a091bda

Browse files
committed
Add WorkingDir property in containers exec
1 parent fba4fd1 commit a091bda

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public interface ExecCreateCmd extends SyncDockerCmd<ExecCreateCmdResponse> {
2626
@CheckForNull
2727
Boolean getPrivileged();
2828

29+
@CheckForNull
30+
String getWorkingDir();
31+
2932
ExecCreateCmd withAttachStderr(Boolean attachStderr);
3033

3134
ExecCreateCmd withAttachStdin(Boolean attachStdin);
@@ -42,6 +45,8 @@ public interface ExecCreateCmd extends SyncDockerCmd<ExecCreateCmdResponse> {
4245

4346
ExecCreateCmd withPrivileged(Boolean isPrivileged);
4447

48+
ExecCreateCmd withWorkingDir(String workingDir);
49+
4550
interface Exec extends DockerCmdSyncExec<ExecCreateCmd, ExecCreateCmdResponse> {
4651
}
4752

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

+18-1
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,20 @@ public class ExecCreateCmdImpl extends AbstrDockerCmd<ExecCreateCmd, ExecCreateC
3333
private Boolean privileged;
3434

3535
/**
36-
* @since {@link RemoteApiVersion#VERSION_1_19}
36+
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_19}
3737
*/
3838
@JsonProperty("User")
3939
private String user;
4040

4141
@JsonProperty("Cmd")
4242
private String[] cmd;
4343

44+
/**
45+
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_35}
46+
*/
47+
@JsonProperty("WorkingDir")
48+
private String workingDir;
49+
4450
public ExecCreateCmdImpl(ExecCreateCmd.Exec exec, String containerId) {
4551
super(exec);
4652
withContainerId(containerId);
@@ -95,6 +101,12 @@ public ExecCreateCmd withPrivileged(Boolean privileged) {
95101
return this;
96102
}
97103

104+
@Override
105+
public ExecCreateCmd withWorkingDir(String workingDir) {
106+
this.workingDir = workingDir;
107+
return this;
108+
}
109+
98110
@Override
99111
public String getContainerId() {
100112
return containerId;
@@ -130,6 +142,11 @@ public String getUser() {
130142
return user;
131143
}
132144

145+
@Override
146+
public String getWorkingDir() {
147+
return workingDir;
148+
}
149+
133150
/**
134151
* @throws NotFoundException
135152
* No such container

0 commit comments

Comments
 (0)