File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
main/java/com/kpelykh/docker/client
test/java/com/kpelykh/docker/client/test Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ public void push(final String name) throws DockerException {
242242 }
243243 try {
244244 final String registryAuth = registryAuth ();
245- client .resource (restEndpointUrl + "/images/" + name + "/push" )
245+ client .resource (restEndpointUrl + "/images/" + name ( name ) + "/push" )
246246 .header ("X-Registry-Auth" , registryAuth )
247247 .accept (MediaType .APPLICATION_JSON )
248248 .post ();
@@ -251,6 +251,10 @@ public void push(final String name) throws DockerException {
251251 }
252252 }
253253
254+ private String name (String name ) {
255+ return name .contains ("/" ) ? name : authConfig .getUsername ();
256+ }
257+
254258 /**
255259 * Create an image by importing the given stream of a tar file.
256260 *
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public void beforeTest() throws Exception {
2323 @ Test
2424 public void testPushLatest () throws Exception {
2525 setUpCredentials ();
26- docker .push ("alexec/ busybox" );
26+ docker .push ("busybox" );
2727 assertThat (asString (docker .pull ("alexec/busybox" )), not (containsString ("404" )));
2828 }
2929
You can’t perform that action at this time.
0 commit comments