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 watchtower dockerfile #2038

Open
Ostico opened this issue Oct 11, 2024 · 2 comments
Open

Comments

@Ostico
Copy link

Ostico commented Oct 11, 2024

Describe the bug

It's happening again #1719 ; I tried different Go versions up to the version 23.

The Dockerfile fail to build.

Steps to reproduce

Just follow the documentation at: https://containrrr.dev/watchtower/private-registries/#example

This is my Dockerfile:

FROM golang:1.18

ENV GO111MODULE off
ENV CGO_ENABLED 0
ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login

RUN go get -u $REPO

RUN rm /go/bin/docker-credential-ecr-login

RUN go build \
 -o /go/bin/docker-credential-ecr-login \
 /go/src/$REPO

WORKDIR /go/bin/

Expected behavior

Should compile the go binary executable.

Screenshots

No response

Environment

Platform: Ubuntu 24.04.1 LTS
Architecture: Linux 6.8.0-1016-aws # aarch64 aarch64 aarch64 GNU/Linux
Docker version 27.3.1

Your logs

$#
docker build -t aws-ecr-credential-helper .
[+] Building 19.2s (5/8)                                                                                                                                                                            docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                          0.0s
 => => transferring dockerfile: 350B                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/golang:1.18                                                                                                                                                1.1s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [1/5] FROM docker.io/library/golang:1.18@sha256:50c889275d26f816b5314fc99f55425fa76b18fcaf16af255f5d57f09e1f48da                                                                                         15.4s
 => => resolve docker.io/library/golang:1.18@sha256:50c889275d26f816b5314fc99f55425fa76b18fcaf16af255f5d57f09e1f48da                                                                                          0.0s
 => => sha256:c345c9e441f5f49235768af74b8ab37743652d38958afaa000edd56d7b2f0540 53.68MB / 53.68MB                                                                                                              2.1s
 => => sha256:7b716680367d1dac0e54c48f75506323e0bb03628542a0fd6db39efeeee9adf5 5.15MB / 5.15MB                                                                                                                0.2s
 => => sha256:0855378f8903bde22cfbcee08cd239678716cf01f24a3fca9478ef4121a84d91 10.87MB / 10.87MB                                                                                                              0.4s
 => => sha256:50c889275d26f816b5314fc99f55425fa76b18fcaf16af255f5d57f09e1f48da 2.36kB / 2.36kB                                                                                                                0.0s
 => => sha256:4d6482bbc33ebe7cfcee9dba6f752b7bf384cb4fea3f5f5162a1464658b92ee3 7.13kB / 7.13kB                                                                                                                0.0s
 => => sha256:053e6cad9f1d6d9f21791df512cee310d4bfbc42effd0c4d64849b7dcb26f6e9 1.80kB / 1.80kB                                                                                                                0.0s
 => => sha256:4bfb8dc93d4197860c2bff47f2c2f280c2dd8ed699e7b3241aa325ecee53c7d7 54.68MB / 54.68MB                                                                                                              1.7s
 => => sha256:530999854f4629231859226fd635c5088244ca7736053631fe412d6325352e6e 81.39MB / 81.39MB                                                                                                              2.9s
 => => extracting sha256:c345c9e441f5f49235768af74b8ab37743652d38958afaa000edd56d7b2f0540                                                                                                                     2.5s
 => => sha256:fc998f6bcdc21e0e8394f3504f109dd36c587a7a86f22e0d1654e42ae5b7bb13 154B / 154B                                                                                                                    3.1s
 => => sha256:6ad9f0b1b9e29fd8991fed0ab142c35910ee460112cda284f4cf9f20ad2ffef8 109.08MB / 109.08MB                                                                                                            5.0s
 => => extracting sha256:7b716680367d1dac0e54c48f75506323e0bb03628542a0fd6db39efeeee9adf5                                                                                                                     0.2s
 => => extracting sha256:0855378f8903bde22cfbcee08cd239678716cf01f24a3fca9478ef4121a84d91                                                                                                                     0.2s
 => => extracting sha256:4bfb8dc93d4197860c2bff47f2c2f280c2dd8ed699e7b3241aa325ecee53c7d7                                                                                                                     2.2s
 => => extracting sha256:530999854f4629231859226fd635c5088244ca7736053631fe412d6325352e6e                                                                                                                     2.2s
 => => extracting sha256:6ad9f0b1b9e29fd8991fed0ab142c35910ee460112cda284f4cf9f20ad2ffef8                                                                                                                     4.8s
 => => extracting sha256:fc998f6bcdc21e0e8394f3504f109dd36c587a7a86f22e0d1654e42ae5b7bb13                                                                                                                     0.0s
 => ERROR [2/5] RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login                                                                                       2.6s
------                                                                                                                                                                                                             
 > [2/5] RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login:
1.844 package maps: unrecognized import path "maps": import path does not begin with hostname
------

 3 warnings found (use docker --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 3)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 4)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 5)
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

Additional context

No response

@Crinchy
Copy link

Crinchy commented Oct 14, 2024

Hey @Ostico 👋,

i have got it working with the following with the following:

Dockerfile:

FROM golang:alpine

ENV GO111MODULE=on
ENV CGO_ENABLED=0

RUN apk add --no-cache git && \
    git clone https://github.com/awslabs/amazon-ecr-credential-helper.git /amazon-ecr-credential-helper

WORKDIR /amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login

RUN go build -o /go/bin/docker-credential-ecr-login

WORKDIR /go/bin

docker-compose.yml:

services:
  watchtower:
    image: containrrr/watchtower
    container_name: watchtower
    restart: always
    environment:
      - WATCHTOWER_LABEL_ENABLE=true
      - WATCHTOWER_POLL_INTERVAL=300
      - WATCHTOWER_NO_STARTUP_MESSAGE=true
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_ROLLING_RESTART=true
      - WATCHTOWER_REMOVE_VOLUMES=true
      - PATH=$PATH:/go/bin
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ${HOME}/.docker/config.json:/config.json:ro
      - ${HOME}/.aws:/.aws:ro
      - helper:/go/bin
    networks:
      - watchtower-network

networks:
  watchtower-network:
    name: watchtower-network
    driver: bridge

volumes:
 helper:
   external: true

Please let me now, if it also works for you 👌

@Ostico
Copy link
Author

Ostico commented Oct 14, 2024

@Crinchy yes, building from source code worked for me too. Thank you!

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

No branches or pull requests

2 participants