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 44
55import com .github .dockerjava .api .command .*;
66import com .github .dockerjava .api .model .AuthConfig ;
7+ import com .github .dockerjava .api .model .Identifier ;
78
89// https://godoc.org/github.com/fsouza/go-dockerclient
910public interface DockerClient extends Closeable {
@@ -29,6 +30,8 @@ public interface DockerClient extends Closeable {
2930
3031 public PushImageCmd pushImageCmd (String name );
3132
33+ public PushImageCmd pushImageCmd (Identifier identifier );
34+
3235 public CreateImageCmd createImageCmd (String repository ,
3336 InputStream imageStream );
3437
Original file line number Diff line number Diff line change 1010import com .github .dockerjava .api .DockerClient ;
1111import com .github .dockerjava .api .command .*;
1212import com .github .dockerjava .api .model .AuthConfig ;
13+ import com .github .dockerjava .api .model .Identifier ;
1314import com .github .dockerjava .core .command .*;
1415
1516/**
@@ -129,8 +130,21 @@ public PushImageCmd pushImageCmd(String name) {
129130 return new PushImageCmdImpl (getDockerCmdExecFactory ()
130131 .createPushImageCmdExec (), name ).withAuthConfig (dockerClientConfig .effectiveAuthConfig (name ));
131132 }
132-
133- @ Override
133+
134+ @ Override
135+ public PushImageCmd pushImageCmd (Identifier identifier ) {
136+ PushImageCmd cmd = pushImageCmd (identifier .repository .name );
137+ if ( identifier .tag .isPresent () )
138+ cmd .withTag (identifier .tag .get ());
139+
140+ AuthConfig cfg = dockerClientConfig .effectiveAuthConfig (identifier .repository .name );
141+ if ( cfg != null )
142+ cmd .withAuthConfig (cfg );
143+
144+ return cmd ;
145+ }
146+
147+ @ Override
134148 public SaveImageCmd saveImageCmd (String name ) {
135149 return new SaveImageCmdImpl (getDockerCmdExecFactory ()
136150 .createSaveImageCmdExec (), name ).withAuthConfig (dockerClientConfig .effectiveAuthConfig (name ));
You can’t perform that action at this time.
0 commit comments