Sierra4x4
Sierra4x4

Reputation: 81

AWS Batch Failing to launch Dockerfile - standard_init_linux.go:219: exec user process caused: exec format error

I am attempting to use AWS Batch to launch a linux server, which will in essence perform the fetch and go example included within AWS (to download a SH from S3 and run it).

Does AWS Batch work at all for anyone?

The aws fetch_and_go example always fails, even followed someone elses guide online which mimicked the aws example.

I have tried creating Dockerfile for amazonlinux:latest and ubuntu:20.04 with numerous RUN and CMD.

The scripts always seem to fail with the error:

standard_init_linux.go:219: exec user process caused: exec format error

I thought at first this was relevant to my deployment access rights maybe within the amazonlinux so have played with chmod 777, chmod -x etc on the she file.

The final nail in the coffin, my current script is litterely:

FROM ubuntu:20.04

Launch this using AWS Batch, no command or parameters passed through and it still fails with the same error code. This is almost hinting to me that there is either a setup issue with my AWS Batch (which im using default wizard settings, except changing to an a1.medium server) or that AWS Batch has some major issues.

Has anyone had any success with AWS Batch launching their own Dockerfiles ? Could they share their examples and/or setup parameters?

Thank you in advance.

Upvotes: 0

Views: 2523

Answers (3)

Madhava Carrillo
Madhava Carrillo

Reputation: 4348

I had the same issue, and it was because I build the image locally on my M1 Mac.

Try adding --platform linux/amd64 to your docker build command before pushing if this is your case.

Upvotes: 5

Christian Kniep
Christian Kniep

Reputation: 76

In addition to the other comment. You can create multi-arch images yourself which will provide the correct architecture. https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

Upvotes: 0

Angel Pizarro
Angel Pizarro

Reputation: 343

A1 instances are ARM based first-generation Graviton CPU. It is highly likely the image you are trying to run something that is expecting x86 CPU (Intel or AMD). Any instance class with a "g" in it ("c6g" or "m5g") are Graviton2 which is also ARM based and will not work for the default examples.

You can test whether a specific container will run by launching an A1 instance yourself and running the container (after installing docker). My guess is that you will get the same error. Running on Intel or AMD instances should work.

To leverage Batch with ARM your containerized application will need to work on ARM. If you point me to the exact example, I can give more details on how to adjust to run on A1 or Graviton2 instances.

Upvotes: 2

Related Questions