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

Unable to install docker-credential-ecr-login using go install #487

Open
kameshsampath opened this issue Feb 7, 2023 · 3 comments
Open

Comments

@kameshsampath
Copy link

/question

As developer trying to use docker-credential-ecr-login, I tried installing using go install

go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/[email protected]

It results in the following error,

go: github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/[email protected]: module github.com/awslabs/[email protected] found, but does not contain package github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login

If I do go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest it works. but I need to pin to a version of the binary.

Any clues?

@reitzig
Copy link

reitzig commented Jul 24, 2023

It is my understanding that you have to give the directory that contains go.mod:

So, for instance:

go install github.com/santhosh-tekuri/jsonschema/cmd/[email protected]

works.

However,

go install "github.com/awslabs/amazon-ecr-credential-helper/[email protected]

does not work, either:

go: github.com/awslabs/amazon-ecr-credential-helper/[email protected]: module github.com/awslabs/[email protected] found, but does not contain package github.com/awslabs/amazon-ecr-credential-helper/ecr-login

This is with golang 1.20.6.

My suspicion is that go.mod and main.go need to be located in the same directory, but I certainly don't fully understand how go install resolves its arguments; the help output is confusing.

@reitzig
Copy link

reitzig commented Jul 24, 2023

In the meantime, I do this as part of my Docker build:

# renovate: datasource=github-tags depName=awslabs/amazon-ecr-credential-helper versioning=semver
ENV AWS_ECR_CRED_HELPER_VERSION="v0.7.1"

RUN apk add --no-cache wget \
 && wget -nv -O /go/bin/docker-credential-ecr-login \
      https://amazon-ecr-credential-helper-releases.s3.us-east-2.amazonaws.com/${AWS_ECR_CRED_HELPER_VERSION#v}/linux-amd64/docker-credential-ecr-login \
 && chmod +x /go/bin/docker-credential-ecr-login

@reitzig
Copy link

reitzig commented Dec 12, 2023

Issue persists with golang 1.21.5.

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

No branches or pull requests

2 participants