aws / aws-toolkit-visual-studio

AWS Toolkit for Visual Studio - a plugin to interact with AWS
https://aws.amazon.com/visualstudio/
Apache License 2.0
109 stars 29 forks source link

Fetching ECR authorization token to use to login with the docker CLI #464

Open JLOrdaz opened 1 month ago

JLOrdaz commented 1 month ago

Describe the bug I try to publish container to ECR and get error with this message:

Fetching ECR authorization token to use to login with the docker CLI

aws-cli/2.17.42 Python/3.11.9 Windows/10 exe/AMD64

Client: Version: 27.2.0 API version: 1.47 Go version: go1.21.13 Git commit: 3ab4256 Built: Tue Aug 27 14:17:17 2024 OS/Arch: windows/amd64 Context: desktop-linux

Server: Docker Desktop 4.34.0 (165256) Engine: Version: 27.2.0 API version: 1.47 (minimum version 1.24) Go version: go1.21.13 Git commit: 3ab5c7d Built: Tue Aug 27 14:15:15 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.20 GitCommit: 8fc6bcff51318944179630522a095cc9dbf9f353 runc: Version: 1.1.13 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0

I have project web i need update to ECR to use Fargate. To Reproduce

Steps to reproduce the behavior example:

  1. Go to publish to container.
  2. and the moment to push, try to connect and get the error.

GTAApi could not be published as Container Image to Amazon Elastic Container Registry (ECR): Failed to push Docker Image due to the following reason: denied: Your authorization token has expired. Reauthenticate and try again.

Toolkit Logs

... docker build: #20 writing image sha256:2aeca5f8751bc73d82ac311e99c8a385fbed9a836db2b03ff05bf07c9976fc51 done ... docker build: #20 naming to docker.io/library/gtaapi:latest done ... docker build: #20 DONE 0.0s ... docker build: View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/4n4rz26ew7btdst1t8z3azxch Fetching ECR authorization token to use to login with the docker CLI Executing docker CLI login command ... invoking 'docker login' ... docker login: WARNING! Using --password via the CLI is insecure. Use --password-stdin. ... docker login: Login Succeeded Found existing ECR Repository gtaapi

Development System (please complete the following information):

Additional context

dmazurek commented 1 month ago

I experienced this too after upgrading to 27.2.0 in Ubuntu 20.04 LTS (full version: 5:27.2.0-1~ubuntu.20.04~focal). Downgrading to 5:27.1.2-1~ubuntu.20.04~focal fixed it.

connorhei commented 1 month ago

I also am experiencing the same issue

jsgal commented 1 month ago

Exactly the same here when using docker desktop 4.34

Workaround is to downgrade to docker desktop 4.33. This solved the problem for me.

Previous versions can be found under the release notes section. I had to uninstall & reinstall (containers + images are lost).

Checking the release notes, 4.34 had changes related to login, authentication, and credential store. Appears to be some sort of conflict with the tool kit and 4.34.

ronmorton commented 3 weeks ago

Same issue for me. After upgrading from 4.33 to 4.34 docker pull gave error repository does not exist or may require 'docker login': denied: Your authorization token has expired. Reauthenticate and try again.

Uninstalling 4.34 and installing 4.33 resolved the issue for now. Unfortunately, you lose all images and have to add again.

ronmorton commented 2 weeks ago

The solution for me was to not include the repository name in "docker login". Based on release notes for Docker Desktop 4.34. https://docs.docker.com/desktop/release-notes/. "Known issue" section. From docker login --username AWS --password-stdin <aws acct>.dkr.ecr.us-east-1.amazonaws.com/<repository name>

to

docker login --username AWS --password-stdin <aws acct>.dkr.ecr.us-east-1.amazonaws.com

It appears prior to 4.34, this wasn't an issue.

dfuentes77 commented 5 days ago

Seems fixed in latest update 4.35.0 (172550)

jsgal commented 2 days ago

Confirmed fixed in 4.35