Skip to content

Proxy bypass for registry inside on-premise and storage back end is s3. #492

Closed

Description

@jayaram-raju

tried providing -e "https_proxy" not working , but similar settings works fine for docker version 1.x

Activity

  1. dmp42 commented on May 5, 2015

    @dmp42
    Contributor

    Can you clarify what the issue is?

    Is this docker -> registry communication or registry -> s3?

    Also, we cannot help without at least some minimal information about your setup. Please see https://github.com/docker/distribution/blob/master/CONTRIBUTING.md#so-you-found-a-bug

    Thanks

  2. dmp42 commented on May 15, 2015

    @dmp42
    Contributor

    @jayaram-raju I'm closing this since I don't have enough information to help you.
    If you can provide answers for my previous questions, I'll reopen this.
    Thanks.

  3. jayaram-raju commented on May 15, 2015

    @jayaram-raju
    Author

    Sorry for the delay , its from registry to s3. as we are hosting the registry inside the enterprise behind the proxy . I might be missing the configuration in registry to upload the images to s3. in docker registry 1.x I was facing the same issue but it got resolved on setting http_proxy as env to registry container.

  4. dmp42 commented on May 15, 2015

    @dmp42
    Contributor

    Ok. Have you tried settings both HTTP_PROXY and HTTPS_PROXY environment variables?
    Can you copy the command you are using to launch the registry?

  5. reopened this on May 15, 2015
  6. jayaram-raju commented on May 19, 2015

    @jayaram-raju
    Author

    Yes I Have set both HTTP_PROXY as well as HTTPS_PROXY
    cmd :-
    sudo docker run -e "HTTP_PROXY=http://<>:<>/" -e "HTTPS_PROXY=http://<>:<>/" registry:2.0

  7. added a commit that references this issue on May 19, 2015
    90768c6
  8. added a commit that references this issue on May 19, 2015
    1a6c906
  9. dmp42 commented on May 19, 2015

    @dmp42
    Contributor

    Hi @jayaram-raju

    Can you provide your registry logs?

    Thanks.

  10. dmp42 commented on May 27, 2015

    @dmp42
    Contributor

    @jayaram-raju can you provide your registry logs?
    Thanks.

  11. damnhandy commented on Jun 23, 2015

    @damnhandy

    I'm running into the same issues. I am running Docker Registry 2.0.1 in an AWS VPC that is all behind a proxy, we direct all S3 traffic through the proxy as well. I am using IAM roles and have verified that the host has full read/write access to the S3 bucket. The registry is also behind an NGinx Proxy as well. I am running with debug logging enabled and here's what I got when I attempted to push a new image to the repo:

    time="2015-06-23T17:27:37.296668865Z" level=debug msg="authorizing request" environment=development http.request.host=docker-registry.mydomain http.request.id=077d63aa-5be4-4462-9205-468ad5fa9044 http.request.method=HEAD http.request.remoteaddr=xxx.xxx.xxx.xxx http.request.uri="/v2/gitbucket/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" http.request.useragent="docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64" instance.id=2b4ff1b4-b905-4eb0-be28-486977c4840e service=registry vars.digest="sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" vars.name=gitbucket version=v2.0.1
    
    time="2015-06-23T17:27:37.296779947Z" level=debug msg=GetImageLayer environment=development http.request.host=docker-registry.mydomain http.request.id=077d63aa-5be4-4462-9205-468ad5fa9044 http.request.method=HEAD http.request.remoteaddr=xxx.xxx.xxx.xxx http.request.uri="/v2/gitbucket/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" http.request.useragent="docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64" instance.id=2b4ff1b4-b905-4eb0-be28-486977c4840e service=registry vars.digest="sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" vars.name=gitbucket version=v2.0.1
    time="2015-06-23T17:27:37.29682428Z" level=debug msg="(*layerStore).Fetch" environment=development http.request.host=docker-registry.mydomain http.request.id=077d63aa-5be4-4462-9205-468ad5fa9044 http.request.method=HEAD http.request.remoteaddr=xxx.xxx.xxx.xxx http.request.uri="/v2/gitbucket/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" http.request.useragent="docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64" instance.id=2b4ff1b4-b905-4eb0-be28-486977c4840e service=registry vars.digest="sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" vars.name=gitbucket version=v2.0.1
    time="2015-06-23T17:27:37.37921153Z" level=info msg="s3.GetContent(\"/docker/registry/v2/repositories/gitbucket/_layers/sha256/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4/link\")" trace.duration=82.298747ms trace.file="/go/src/github.com/docker/distribution/registry/storage/driver/base/base.go" trace.func="github.com/docker/distribution/registry/storage/driver/base.(*Base).GetContent" trace.id=f6b5c3e6-624b-46f6-980a-e8cd8a225457 trace.line=55
    time="2015-06-23T17:27:37.379316264Z" level=error msg="An error occured" environment=development err.code=UNKNOWN err.detail="Access Denied" err.message="unknown error" http.request.host=docker-registry.mydomain http.request.id=077d63aa-5be4-4462-9205-468ad5fa9044 http.request.method=HEAD http.request.remoteaddr=xxx.xxx.xxx.xxx http.request.uri="/v2/gitbucket/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" http.request.useragent="docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64" instance.id=2b4ff1b4-b905-4eb0-be28-486977c4840e service=registry vars.digest="sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" vars.name=gitbucket version=v2.0.1
    time="2015-06-23T17:27:37.379437717Z" level=info msg="response completed" environment=development http.request.host=docker-registry.mydomain http.request.id=077d63aa-5be4-4462-9205-468ad5fa9044 http.request.method=HEAD http.request.remoteaddr=xxx.xxx.xxx.xxx http.request.uri="/v2/gitbucket/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" http.request.useragent="docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64" http.response.contenttype="application/json; charset=utf-8" http.response.duration=84.383211ms http.response.status=400 http.response.written=83 instance.id=2b4ff1b4-b905-4eb0-be28-486977c4840e service=registry version=v2.0.1
    172.17.0.2 - - [23/Jun/2015:17:27:37 +0000] "HEAD /v2/gitbucket/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 HTTP/1.1" 400 83 "" "docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/4.0.3-boot2docker os/linux arch/amd64"
    
  12. dmp42 commented on Jun 23, 2015

    @dmp42
    Contributor
  13. damnhandy commented on Jun 24, 2015

    @damnhandy

    Scratch that. It turns out it was in fact an IAM permission issue. My initial policy was something like so:

            {
                "Effect": "Allow",
                "Action": [
                    "s3:*"
                ],
                "Resource": "arn:aws:s3:::mybucket/*"
            }
    

    Once I changed it to this:

        {
            "Effect": "Allow",
            "Action": "s3:ListAllMyBuckets",
            "Resource": "arn:aws:s3:::*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Resource": "arn:aws:s3:::mybucket"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject"
            ],
            "Resource": "arn:aws:s3:::mybucket/*"
        }
    

    Everything started working, proxy and all. Sorry for the false alarm. But the Registry does indeed pick up the proxy environment variables from the host if present. It was hard to tell if it was the proxy or S3 that was returning the access error.

    However, the documentation could highlight the necessary IAM polices for S3 and perhaps the error message could indicate what S3 calls it's trying to make. The message "An Error Occurred" is somewhat cryptic in determining the source of the error.

  14. stevvooe commented on Jun 24, 2015

    @stevvooe
    Collaborator

    @damnhandy Could expand on what you mean by adding documentation? I am a little unfamiliar with this particular problem and am unsure what exactly would need to be changed to help future users avoid this issue. Would mind submitting a PR to the s3 documentation?

    cc @moxiegirl

  15. damnhandy commented on Jun 26, 2015

    @damnhandy

    What I was getting that was that if you use a naïve IAM policy like I was doing, you run into issues. My issue was more of an AWS configuration problem and not a Registry problem. I will submit a PR next week for the docs.

    However, I can confirm that the registry is functioning just fine when using the both HTTP_PROXY and HTTPS_PROXY environment variables. But I am doing so using --env-file but things are indeed going through the proxy with the registry -> s3 communication. I would close this particular issue regarding the proxy.

  16. stevvooe commented on Jun 26, 2015

    @stevvooe
    Collaborator

    @damnhandy Thank you. I assume you'll be add something that will point out possible issues with IAM roles.

    Looking at the registry logs a little more closely, it looks like the s3 library reports little context for the error. This explains the cryptic "Access Denied". I can't promise anything immediately, but I've filed #664 to explore some better error messages here.

  17. assigned and unassigned on Jul 24, 2015
  18. BrianBland commented on Jan 26, 2016

    @BrianBland
    Contributor

    Closing with #1391 to cover the IAM permissions documentation

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions