Skip to content

Commit 4e80442

Browse files
committed
Merge pull request #19 from YouTechnology/master
Add missing options to BuildCmd and set them to match Docker client.
2 parents e2f260d + efe372c commit 4e80442

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/java/com/github/dockerjava/client/command/BuildImgCmd.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public class BuildImgCmd extends AbstrDockerCmd<BuildImgCmd, ClientResponse> {
4747
private InputStream tarInputStream = null;
4848
private String tag;
4949
private boolean noCache;
50+
private boolean remove = true;
51+
private boolean quiet;
5052

5153

5254
public BuildImgCmd(File dockerFolder) {
@@ -74,11 +76,23 @@ public BuildImgCmd withNoCache(boolean noCache) {
7476
return this;
7577
}
7678

79+
public BuildImgCmd withRemove(boolean rm) {
80+
this.remove = rm;
81+
return this;
82+
}
83+
84+
public BuildImgCmd withQuiet(boolean quiet) {
85+
this.quiet = quiet;
86+
return this;
87+
}
88+
7789
@Override
7890
public String toString() {
7991
return new StringBuilder("build ")
8092
.append(tag != null ? "-t " + tag + " " : "")
8193
.append(noCache ? "--nocache=true " : "")
94+
.append(quiet ? "--quiet=true " : "")
95+
.append(!remove ? "--rm=false " : "")
8296
.append(dockerFolder != null ? dockerFolder.getPath() : "-")
8397
.toString();
8498
}
@@ -104,6 +118,12 @@ protected ClientResponse callDocker(final InputStream dockerFolderTarInputStream
104118
if (noCache) {
105119
params.add("nocache", "true");
106120
}
121+
if (remove) {
122+
params.add("rm", "true");
123+
}
124+
if (quiet) {
125+
params.add("q", "true");
126+
}
107127

108128
WebResource webResource = baseResource.path("/build").queryParams(params);
109129

0 commit comments

Comments
 (0)