- Newest
- Most votes
- Most comments
The image was stored not in ECR but in GitHub repo. The problem was that the repo was private. Lightsail was failing to download the image.
There are a few potential issues that could be causing your Lightsail container deployment to fail:
- Container Name Mismatch: The most common issue with Lightsail container deployments is a mismatch between the container name in your containers.json and public-endpoint.json files. Make sure the containerName in your public-endpoint.json matches exactly what you've defined in containers.json.
For example, if your containers.json has:
{
"myapp": {
"image": "...",
"ports": {
"80": "HTTP"
}
}
}
Then your public-endpoint.json should have:
{
"containerName": "myapp",
"containerPort": 80
}
-
Architecture Issues: Since you're developing on a local machine, there might be architecture compatibility issues. If you're using an M1/M2 Mac, make sure you're building your Docker image with the correct platform flag:
--platform linux/x86_64. -
Docker Desktop Settings: If you're using Docker Desktop, try disabling "Use containerd for pulling and storing images" in the Docker Desktop settings, as this has been known to cause issues with image uploads to AWS services.
-
Dockerfile Considerations:
- Your Dockerfile looks generally correct, but ensure you're using the right .NET version (you mention .NET 9 in your description but use .NET 8 in your Dockerfile)
- Make sure your ASPNETCORE_URLS environment variable is correctly set to match the port you're exposing
- Verify that your application is properly listening on the port specified in your Lightsail configuration
- Lightsail Configuration: Double-check your Lightsail container service configuration, including:
- Ensure the port mappings are correct
- Verify that the container has sufficient resources allocated
- Check that the public endpoint is properly configured
Try deploying with these adjustments and check the Lightsail logs for more detailed error information if the issue persists.
Sources
InvalidInputException error for containerName when deploying to AWS lightsail using AWS-CLI in Mac M1 | AWS re:Post
Lightsail image failed commit - 400 Bad Request | AWS re:Post
Relevant content
- asked 4 years ago
- asked 3 years ago
- asked 3 years ago
- AWS OFFICIALUpdated a year ago
