-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
Describe the bug
On https://containrrr.dev/watchtower/private-registries/#credential_helpers, there is a Dockerfile example that does not work.
When I ran the Dockerfile (on EC2 instance) it kept failing all the way thru the versions until i set the Go version to 1.22, and adjusted the commands bellow for the new version.
The bellow Dockerfile worked for me.
FROM golang:1.23
ENV CGO_ENABLED=0
# Install the ECR Docker credential helper
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest
# Add Go bin to PATH
ENV PATH="/go/bin:${PATH}"
WORKDIR /go/bin/
The use-case is that watchtower is running on an EC2 instance and i the image it updates is on an ECR repo.
Versions:
Docker version 25.0.8, build 0bab007
aws-cli/2.27.57 Python/3.9.23 Linux/6.1.147-172.266.amzn2023.x86_64 source/x86_64.amzn.2023
Steps to reproduce
- Copy the Dockerfile from https://containrrr.dev/watchtower/private-registries/#credential_helpers
- Build it with
docker build -t aws-ecr-dock-cred-helper .
Expected behavior
The image gets built, the commands after it execute with no problem and watchtower can pull images from ECR
Screenshots
No response
Environment
- EC2 instance
- "Amazon Linux" VERSION="2023"
- Docker version 25.0.8, build 0bab007
- aws-cli/2.27.57 Python/3.9.23 Linux/6.1.147-172.266.amzn2023.x86_64 source/x86_64.amzn.2023
Your logs
Multiple sets logs (docker build fails) as I test thru the versions of Go:
=> ERROR [2/5] RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login 3.4s ------ > [2/5] RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login: 3.034 package maps: unrecognized import path "maps": import path does not begin with hostname 3.151 package slices: unrecognized import path "slices": import path does not begin with hostname ------ Dockerfile:7 -------------------- 5 | ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login 6 | 7 | >>> RUN go get -u $REPO 8 | 9 | RUN rm /go/bin/docker-credential-ecr-login -------------------- ERROR: failed to solve: process "/bin/sh -c go get -u $REPO" did not complete successfully: exit code: 1
=> ERROR [2/5] RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login 0.9s ------ > [2/5] RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login: 0.744 go: go.mod file not found in current directory or any parent directory. 0.744 'go get' is no longer supported outside a module. 0.744 To build and install a command, use 'go install' with a version, 0.744 like 'go install example.com/cmd@latest' 0.744 For more information, see https://golang.org/doc/go-get-install-deprecation 0.744 or run 'go help get' or 'go help install'. ------ Dockerfile:7 -------------------- 5 | ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login 6 | 7 | >>> RUN go get -u $REPO 8 | 9 | RUN rm /go/bin/docker-credential-ecr-login -------------------- ERROR: failed to solve: process "/bin/sh -c go get -u $REPO" did not complete successfully: exit code: 1
2.864 pkg/mod/github.com/aws/smithy-go@v1.22.4/properties.go:3:8: package maps is not in GOROOT (/usr/local/go/src/maps) 2.864 note: imported by a module that requires go 1.22 ------ Dockerfile:6 -------------------- 4 | 5 | # Install the ECR Docker credential helper 6 | >>> RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest 7 | 8 | # Add Go bin to PATH -------------------- ERROR: failed to solve: process "/bin/sh -c go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest" did not complete successfully: exit code: 1
=> ERROR [2/3] RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest 1.5s ------ > [2/3] RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest: 1.234 go: downloading github.com/awslabs/amazon-ecr-credential-helper v0.10.1 1.429 go: downloading github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.10.1 1.441 go: github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest: github.com/awslabs/amazon-ecr-credential-helper/ecr-login@v0.10.1 requires go >= 1.23 (running go 1.22.12; GOTOOLCHAIN=local) ------ Dockerfile:6 -------------------- 4 | 5 | # Install the ECR Docker credential helper 6 | >>> RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest 7 | 8 | # Add Go bin to PATH -------------------- ERROR: failed to solve: process "/bin/sh -c go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest" did not complete successfully: exit code: 1
Additional context
No response