File tree Expand file tree Collapse file tree
src/main/java/com/github/dockerjava Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,12 +14,19 @@ public interface PushImageCmd extends DockerCmd<InputStream>{
1414
1515 public String getName ();
1616
17+ public String getTag ();
18+
1719 /**
1820 * @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
1921 */
2022 public PushImageCmd withName (String name );
2123
22- public AuthConfig getAuthConfig ();
24+ /**
25+ * @param tag The image's tag. Not null.
26+ */
27+ public PushImageCmd withTag (String tag );
28+
29+ public AuthConfig getAuthConfig ();
2330
2431 public PushImageCmd withAuthConfig (AuthConfig authConfig );
2532
Original file line number Diff line number Diff line change 1414 */
1515public class PushImageCmdImpl extends AbstrAuthCfgDockerCmd <PushImageCmd , InputStream > implements PushImageCmd {
1616
17- private String name ;
17+ private String name ;
18+ private String tag ;
1819
19- public PushImageCmdImpl (PushImageCmd .Exec exec , String name ) {
20- super (exec );
21- withName (name );
22- }
20+ public PushImageCmdImpl (PushImageCmd .Exec exec , String name ) {
21+ super (exec );
22+ withName (name );
23+ }
2324
2425 @ Override
2526 public String getName () {
2627 return name ;
2728 }
2829
30+ @ Override
31+ public String getTag () {
32+ return tag ;
33+ }
34+
2935 /**
3036 * @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
3137 */
@@ -36,6 +42,16 @@ public PushImageCmd withName(String name) {
3642 return this ;
3743 }
3844
45+ /**
46+ * @param tag The image's tag. Can be null or empty.
47+ */
48+ @ Override
49+ public PushImageCmd withTag (String tag ) {
50+ Preconditions .checkNotNull (tag , "tag was not specified" );
51+ this .tag = tag ;
52+ return this ;
53+ }
54+
3955 @ Override
4056 public String toString () {
4157 return new StringBuilder ("push " )
@@ -46,7 +62,7 @@ public String toString() {
4662 /**
4763 * @throws NotFoundException No such image
4864 */
49- @ Override
65+ @ Override
5066 public InputStream exec () throws NotFoundException {
5167 return super .exec ();
5268 }
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ public PushImageCmdExec(WebTarget baseResource) {
2424
2525 @ Override
2626 protected InputStream execute (PushImageCmd command ) {
27- WebTarget webResource = getBaseResource ().path ("/images/" + name (command ) + "/push" );
27+ WebTarget webResource = getBaseResource ().path ("/images/" + name (command ) + "/push" )
28+ .queryParam ("tag" , command .getTag ());
2829
2930 final String registryAuth = registryAuth (command .getAuthConfig ());
3031 LOGGER .trace ("POST: {}" , webResource );
You can’t perform that action at this time.
0 commit comments