- Newest
- Most votes
- Most comments
Unfortunately, AWS Batch does not directly support running jobs from local Docker images pre-loaded in a custom AMI. AWS Batch is designed to work with container images stored in container registries, primarily Amazon Elastic Container Registry (ECR).
The error you're encountering suggests that AWS Batch is still trying to pull the image from a registry, even though you've specified a local image name. This is because AWS Batch expects the image to be in a registry it can access.
To address your issue with long pull times, there are a few alternative approaches you could consider:
-
Use ECR with optimizations:
- Ensure you're using the latest ECR features like image scanning and caching to optimize pull times.
- Consider using multi-stage builds to reduce your image size further.
-
Use a private Docker registry: AWS Batch now supports private Docker registries with managed Elastic Container Service (ECS) compute environments. You could set up a private registry within your VPC to potentially reduce pull times.
-
Modify your job submission process: Instead of trying to use a pre-loaded image, you could create a wrapper script in your custom AMI that checks for the presence of the local image, and only pulls from ECR if it's not present. This script would then be the entry point for your Batch job.
-
Use Amazon ECS container instance draining: This feature allows you to keep container instances running between jobs, potentially reducing the need for frequent image pulls.
While these solutions don't directly allow you to use a local image as you initially intended, they may help address the underlying issue of long pull times. If pull times remain a significant issue even after optimization, you may need to reconsider your overall architecture or reach out to AWS support for more specific guidance.
Remember, when using custom AMIs or modifying job submission processes, ensure that your approach aligns with AWS Batch's security and operational requirements.
Sources
AWS Batch now supports private registry on ECS compute environments
Running batch jobs at scale with EC2 Spot Instances
Relevant content
asked 4 years ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 years ago
