Page 1 of 1

Custom Docker Image on F2-210

Posted: 27 Aug 2021, 11:22
by bluebell
I'm trying to create a custom docker image and import to Docker on my F2-210.
I can not however manage to get passed the error standard_init_linux.go:187: exec user process caused "exec format error"

here is my simple app.py.

Code: Select all

import os
from flask import Flask

ipAddress = os.environ['HOST_IP']

app = Flask(__name__)

@app.route('/')
def index():
    return 'Hey, we have Flask in a Docker container!'
    
if __name__ == "__main__":
    app.run(debug=True, host=ipAddress)
here is my Dockerfile.

Code: Select all

# syntax=docker/dockerfile:1

FROM python:3.9.6-slim-buster

ENV HOST_IP="0.0.0.0"

# We copy just the requirements.txt first to leverage Docker cache
COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

CMD [ "python", "./app.py" ]
I have:
  • successfully run on local machine prior to each test
  • tried adding the shebang #!/bin/bash at the start of the Dockerfile
  • changed line endings to LF instead of CRLF
Can someone please help me out here.... even with an example of something you have successfully imported to TOS Docker.
The last thing I can think of is that the F2-210 is an ARM processor and apparently Docker runs different on that... but I don't know if that is the issue, or how to implement change for that.

Look forward to your replies.

Re: Custom Docker Image on F2-210

Posted: 27 Aug 2021, 12:11
by bluebell
For those that come across this post and issue... I did some digging and was correct!
It was due to the image being built as x86-64, and had to force build to ARM for my specific NAS...

I was using the build command:
docker build -t python-docker .

when it SHOULD have been:
docker build --platform linux/arm64 -t python-docker .

That solved all my issues :D