Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to push Application from private Docker Registry #941

Closed
harald-luebeck opened this issue Jan 19, 2019 · 3 comments · Fixed by #959
Closed

How to push Application from private Docker Registry #941

harald-luebeck opened this issue Jan 19, 2019 · 3 comments · Fixed by #959
Assignees

Comments

@harald-luebeck
Copy link

I want to push an Application from a Private Docker Registry. The "push" works but the app fails during staging. It seems that the Docker Registry Authorization Data is not correct.

Here is my Code:

public void deployApplication( final String applicationUId, final String dockerImage, final String dockerUserName, final String dockerPassword )
{
final DefaultCloudFoundryOperations cloudFoundryOperations = DefaultCloudFoundryOperations.builder().cloudFoundryClient( cloudFoundryClient ).dopplerClient( dopplerClient ).uaaClient( uaaClient ).organization( organization ).space( space ).build();

	final PushApplicationRequest.Builder pushApplicationRequestBuilder = PushApplicationRequest.builder().dockerImage( dockerImage ).name( applicationUId ).noStart( true );

	if( dockerUserName != null )
	{
		pushApplicationRequestBuilder.dockerUsername( dockerUserName ).dockerPassword( dockerPassword );
	}

	final PushApplicationRequest pushApplicationRequest = pushApplicationRequestBuilder.build();

	final Object application = cloudFoundryOperations.applications().push(pushApplicationRequest).doOnSuccess(v -> System.out.println("Done")).doOnError(e -> System.out.println("Error creating app was " + e)).block(Duration.ofMinutes(30));
	System.out.println( "STOP" );
}

What is my mistake ?

Thanks

@twoseat twoseat self-assigned this Jan 21, 2019
@twoseat
Copy link
Contributor

twoseat commented Jan 21, 2019

Hi @harald-luebeck. Can you post the error you get from the fail? Don't forget to remove any passwords etc. if they're in there. Also, do the same credentials work if you use the cli (cf push --docker-username)?

@harald-luebeck
Copy link
Author

The push succeeds but the staging Error is:

2019-01-21T11:28:57.49+0100 [STG/0] ERR Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized Going to retry attempt: 1
2019-01-21T11:28:57.61+0100 [STG/0] ERR Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized Going to retry attempt: 2
2019-01-21T11:28:57.74+0100 [STG/0] ERR Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized Going to retry attempt: 3
2019-01-21T11:28:57.87+0100 [STG/0] ERR Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized
2019-01-21T11:28:57.87+0100 [STG/0] ERR Staging process failed: Exit trace for group:
2019-01-21T11:28:57.87+0100 [STG/0] ERR builder exited with error: failed to fetch metadata from [cloud/insign] with tag [9.5.1] and insecure registries [] due to unauthorized: access to the requested resource is not authorized

If i push this stuff via cli it works.

@twoseat
Copy link
Contributor

twoseat commented Jan 21, 2019

Thanks for the additional information. We introduced support for private docker repos quite early, when it was still an experimental feature. Unfortunately the implementation details have been changed since then (for example the relevant field has been renamed), so we're not compatible with reality! I've made this an issue for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants