aws / lightsailctl

Amazon Lightsail CLI Extensions
Apache License 2.0
19 stars 4 forks source link

"Unexpected status from PUT request ..." when using aws lightsail push-container-image #95

Open kahwooi opened 2 weeks ago

kahwooi commented 2 weeks ago

AWS CLI version:

aws --version
aws-cli/2.19.2 Python/3.12.6 Windows/11 exe/AMD64

AWS push image command:

aws lightsail push-container-image --region ap-southeast-1 --service-name multisites --label latest --image fileserver:latest --debug

Response with error:

[7BskipStatuses: file has already been closed
failed commit on ref "manifest-sha256:b952282490bfea5fafd5e29c3fbf34ed76c75fb3a6f27f426f15c16ad56086ad": unexpected status from PUT request to https://01234567890.dkr.ecr.ap-southeast-1.amazonaws.com/v2/sr/manifests/179925523046539500-6s3mh2aluueng: 400 Bad Request
2024-11-08 08:25:23,788 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awscli\clidriver.py", line 499, in main
  File "awscli\clidriver.py", line 634, in __call__
  File "awscli\customizations\commands.py", line 206, in __call__
  File "awscli\customizations\lightsail\push_container_image.py", line 65, in _run_main
  File "subprocess.py", line 571, in run
subprocess.CalledProcessError: Command '['lightsailctl', '--plugin', '--input-stdin']' returned non-zero exit status 1.

Command '['lightsailctl', '--plugin', '--input-stdin']' returned non-zero exit status 1.
paxan commented 3 days ago

Hi @kahwooi

We think this issue happens when an image, that was built while using Docker's containerd image store feature, is being pushed to Lightsail-managed container image repository (basically, when you use aws lightsail push-container-image ... command).

Workaround

Please try disabling "containerd image store" feature. The screenshot below shows how it looks when it is enabled. Ensure it is unchecked and press "Apply & restart" button.

image

Once that feature is disabled, please build your container app and then push it. For example, if the local image ref is blog-app, then you'll do something like this:

$ docker build --platform=linux/amd64 -t blog-app .

$ aws lightsail push-container-image --image blog-app --label server --service-name my-blog

Please comment here if this workaround helps or if it doesn't.

Meanwhile, we are investigating a solution on our end, such that customers won't need this workaround.

Thank you for reporting this issue and being a Lightsail customer.