Docker run fails when using CMD with exec format error

Haven’t been able to find any info on this but I’m hoping it’s something simple. I’m trying to create a basic image that runs a python script by default. I’ve set the command line now to just “python --help” to remove any complexity around actually executing the script:

FROM python:3.5.2
WORKDIR /opt
COPY script.py .
CMD ["python", "--help"]

When I run the image like this:

docker run the-image python --help

It works just fine, the help text is printed out. When I run it without overriding the command I get this:

docker run the-image
standard_init_linux.go:175: exec user process caused "exec format error"

I’ve tried absolute paths and different variations, but the results are always the same: works fine if I manually enter the command line but fails with “exec format error” if I leave that blank to use the CMD directive.

This is on the latest Docker for Windows, running on Win10 x64

1 Like

Problem went away by changing the file encoding to ASCII (not sure what it was by default). Line endings were already Linux style.