Skip to content

Commit f45a55b

Browse files
author
troubadout
committed
introduce support for Env in docker exec create
1 parent d941624 commit f45a55b

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
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[] getEnv();
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 withEnv(String... env);
49+
4550
interface Exec extends DockerCmdSyncExec<ExecCreateCmd, ExecCreateCmdResponse> {
4651
}
4752

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ public class ExecCreateCmdImpl extends AbstrDockerCmd<ExecCreateCmd, ExecCreateC
4141
@JsonProperty("Cmd")
4242
private String[] cmd;
4343

44+
/**
45+
* @since {@link RemoteApiVersion#VERSION_1_25}
46+
*/
47+
@JsonProperty("Env")
48+
private String[] env;
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 withEnv(String... env) {
106+
this.env = env;
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[] getEnv() {
147+
return env;
148+
}
149+
133150
/**
134151
* @throws NotFoundException
135152
* No such container

0 commit comments

Comments
 (0)