Moby: Image push failed Error parsing HTTP response: unexpected end of JSON input: ""

Created on 31 Dec 2015  Â·  14Comments  Â·  Source: moby/moby

Trying to start my docker service again on my Ubuntu AWS EC2 host and get this. No idea why it's failing on JSON parsing.

Command I ran:

docker push xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/ubuntu:xenial

Error I get in the AWS EC2 Host at the terminal:

The push refers to a repository xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/ubuntu
2bdece1db94a: Image push failed
Error parsing HTTP response: unexpected end of JSON input: ""

(Note: I x'd out my real AWS account number for obvious security for the post here)

Most helpful comment

If you are trying to push to an ECR repository, you need to make sure that the ecr:BatchCheckLayerAvailability permission is also checked. It is not selected by default when using the default push permissions that ECR sets.

All 14 comments

If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.

If you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.

For more information about reporting issues, see CONTRIBUTING.md.

You _don't_ have to include this information if this is a _feature request_

(This is an automated, informational response)


BUG REPORT INFORMATION

Use the commands below to provide key information from your environment:

docker version:
docker info:

Provide additional environment details (AWS, VirtualBox, physical, etc.):

List the steps to reproduce the issue:
1.
2.
3.

Describe the results you received:

Describe the results you expected:

Provide additional info you think is important:

----------END REPORT ---------

ENEEDMOREINFO

No idea if this is a bug but here's more info. Seems like this might be a common issue with AWS and docker but I can't find anything useful to help resolve it.

docker version: 1.9.1, build a34a1d5/1.9.1
docker info: from where? Please be specific, what file? And what path is it located for whatever logs you're asking me for for docker?

The output requested is from the docker version and docker info commands; run those commands, and add the output to your report :-)

In this case, it's possible that this is an issue with the Amazon ECR; have you try contacting their support? I also found this issue on StackOverflow that looks similar; http://stackoverflow.com/questions/34423873/docker-push-to-aws-ecr-private-repo-failing-with-malformed-json

Yea I've already done other due diligence. Hoping someone here has seen the error as I haven't got any response from AWS yet. I have also already seen that stack thread of course and there isn't even a security group called what the answer says worked anymore so that thread is useless.

You might want to search for existing issues; https://github.com/docker/docker/issues?utf8=✓&q=is%3Aissue+%22unexpected+end+of+JSON+input%22+

@dschinkel logging in again using aws ecr get-login --region us-east-1 fixed this for me

If you are trying to push to an ECR repository, you need to make sure that the ecr:BatchCheckLayerAvailability permission is also checked. It is not selected by default when using the default push permissions that ECR sets.

Based on the discussion above, this doesn't look to be a bug or issue in docker, but in using the correct settings / steps for Amazon ECR.

For that reason, I'll close this issue, bug feel free to continue the discussion here :+1:

I am seeing this issue as well while using the 2.1 version of the docker registry (library/registry:2.1), with docker version 1.9.1

I originally had a much earlier version of docker and did not have these problems until I got to the 1.9.1 version - not sure if something in my local repository is screwed up on account of that.

Also, I had this problem attempting to push to the registry, version 1 with docker 1.9.1. So it seems unrelated to registry version?

By default ECR repositories do not have a policy. Once that's created and includes the permissions needed the issue should be resolved.

+1 @alfonso-cabrera I fixed adding ecr:BatchCheckLayerAvailability permission

ecr:BatchCheckLayerAvailability fixed issue for me as well, here is a working wildcard policy example

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ecr:GetAuthorizationToken",
                "ecr:InitiateLayerUpload",
                "ecr:UploadLayerPart",
                "ecr:CompleteLayerUpload",
                "ecr:BatchCheckLayerAvailability",
                "ecr:PutImage"
            ],
            "Resource": "*"
        }
    ]
}

Added ecr:PutImage

Was this page helpful?
0 / 5 - 0 ratings