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

az acr login failure #4843

Closed
revodavid opened this Issue Nov 7, 2017 · 11 comments

Comments

Projects
None yet
10 participants
@revodavid
Copy link
Member

revodavid commented Nov 7, 2017

Attempting to log in to a Container Registry server gives me a "stub received bad data" error. (Same thing happens running PowerShell in admin mode.)

PS> az acr login --name contregdmsmith
Error saving credentials: error storing credentials - err: exit status 1, out: `The stub received bad data.
### Environment summary

Install Method: MSI
CLI version: azure-cli (2.0.20)
OS version: Windows 10 (1703 // 15063.674)
Shell Type: Powershell  
@yugangw-msft

This comment has been minimized.

Copy link
Contributor

yugangw-msft commented Nov 8, 2017

This is a known issue, see below for the workaround that @djyou provided through a recent email exchange

“acr login” uses AAD and docker in Windows uses wincred to save ACR refresh token by default. The token can sometimes exceed 4K in length (e.g., due to customized roles) which will get truncated. You didn’t see it when credential is specified because username/password pair is much shorter.

One quick workaround is to modify <User folder>\.docker\config.json file. Remove the following line so docker will use file system to store tokens:

               "credsStore": "wincred"

We are also rolling out a fix in the token server that will limit the token length.

@jblackburn21

This comment has been minimized.

Copy link

jblackburn21 commented Nov 14, 2017

I'm running to this issue on Windows 10 as well, but I do not have the .docker\config.json file, and cannot find this setting anywhere. Is there an alternative location for it?

OS Version: Win 10 Pro 1709
Docker Version: 17.09.0-ce-win33

@djyou

This comment has been minimized.

Copy link
Member

djyou commented Nov 14, 2017

@jblackburn21 Do you have a $HOME/.docker folder at all?

If you have the folder but not the config.json file, you can create the file with content similar to

{
	"auths": {
		"azurecr.io": {
		}
	}
}

Or the file will be generated once you have a successful docker login or acr login.

Adding @shhsu as this is a server side issue and requires further improvement. /cc @sajayantony

@shhsu

This comment has been minimized.

Copy link
Contributor

shhsu commented Nov 14, 2017

@yugangw-msft @revodavid @jblackburn21 @djyou , directly hacking the config.json is not an ideal solution. Please install https://github.com/Azure/acr-docker-credential-helper
This credential helper would help redirect the credentials to the correct stores and without it your login will expire every hour.

@sajayantony

This comment has been minimized.

Copy link

sajayantony commented Nov 14, 2017

@jblackburn21 - the Credential helper is something that is being worked on and not yet released. @shhsu is working on release it officially since this solves the credential renew issue.
The main issue is that the token is larger than what windows credential store can handle and hence failing.
The workaround that @djyou suggested is something that can unblock you and will create a config file that will use the default file credential store instead of the windows credential store.

'{"auths": {"contregdmsmith.azurecr.io": {}}}' | Set-Content $HOME/.docker/config.json
az acr login -n contregdmsmith

I think we can consider fixing the CLI to prompt setting the credential store automatically as a fix to this bug.

@jblackburn21

This comment has been minimized.

Copy link

jblackburn21 commented Nov 15, 2017

Thanks. I was able to use the workaround.

@koolrays

This comment has been minimized.

Copy link

koolrays commented Dec 2, 2017

Thanks workaround also worked for me.

@zhang-zedong

This comment has been minimized.

Copy link

zhang-zedong commented Jan 23, 2018

Thanks. I was also able to use the workaround on mac.

@StephenWeatherford

This comment has been minimized.

Copy link

StephenWeatherford commented Oct 11, 2018

@sajayantony What's the status of this issue? Is it getting fixed? Thx.

@sajayantony

This comment has been minimized.

Copy link

sajayantony commented Oct 11, 2018

@StephenWeatherford Is this still failing? The wincred fix has already been merged.

@StephenWeatherford

This comment has been minimized.

Copy link

StephenWeatherford commented Oct 11, 2018

Well, actually I didn't see it but wasn't sure if it always repros. I just merged Rutu's code that handles that error. Hopefully it will never come up. Thanks!

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