First Batch job fails with CannotPullContainerError

2

I am trying to walk through the simple "Submit your first Batch job" for AWS Batch. I go through all of the 5 steps, choosing Fargate as the platform, and leaving all items at default values, and finally submit the job. However, the job fails with this status reason:

CannotPullContainerError: inspect image has been retried 5 time(s): failed to resolve ref "docker.io/library/amazonlinux:latest": failed to do request: Head https://registry-1.docker.io/v2/library/amazonlinux/manifests/latest: dial tcp 34.237.244.67:44...

I am probably missing something very basic, but have no idea what. Thanks!

  • Update: If I change the platform to EC2 it seems to work. Any ideas why Fargate does not?

  • I received the same error on Fargate as well, following the same steps. +1 for this question.

asked 10 months ago489 views
1 Answer
4
Accepted Answer

Hello! If using Fargate and the subnets associated with your Batch compute environment do not have a NAT Gateway attached, your job will fail as it cannot connect to the internet to pull the Docker image. To solve this issue, you can set the assignPublicIp parameter in the Batch job definition to be ENABLED. For more info on Fargate compute environments in Batch, check out this documentation.

profile picture
answered 10 months ago
  • Thanks very much. It would be worth adding this small detail to that tutorial.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions