Docker Community Forums

Share and learn in the Docker community.

Issue running helloworld python app

I am new to Docker. Please provide me help on the following:
I have below helloworld.py pythan file:

------helloworld.py -----------

from flask import Flask
app = Flask(name)
@app.route("/")
def hello():
return “hello world!”

if name == “main”:
app.run(host=“0.0.0.0”)

DockerFile have bellow contents:
----------DockerFile ------------
FROM python:3.6.1-alpine
RUN pip install flask
CMD [“python”,“helloworld.py”]
COPY app.py /helloworld.py

I run below command. It works fine.
PS C:\Windows\system32\temp> docker image build -t python-hello-world .

PS C:\Windows\system32\temp> docker images
python-hello-world latest 45191f1cc94c 2 hours ago 98.5MB

PS C:\Windows\system32\temp> docker run -p 6001:6000 -d python-hello-world

Here is the failuer.
I tried google but can not find out how to fix it.

PS C:\Windows\system32\temp> docker ps -a
fe4763977bff python-hello-world “python /helloworld.py” 8 minutes ago Exited (1) 8 minutes ago

PS C:\WINDOWS\system32\temp> docker container logs fe4763977bff
File “app.py”, line 1
SyntaxError: Non-UTF-8 code starting with ‘\xff’ in file helloworld.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details