3

I am trying to create a docker container for a simple Flask based Api (python 3 dependant) but I am having issues and I don't understand what the issue is.

My Dockerfile is:

FROM python:3-alpine
RUN pip install --upgrade pip
RUN pip install waitress
CMD ["waitress-serve", "--call CoreApi:create_app"]

I am then building and running it as follows:

docker build -f GameApi/Dockerfile -t coreapi .
docker run -d -p 2020:2020 coreapi

The docker container dies after a few seconds and if I check it I get:

$ docker logs 45f8008d787a
Error: option --call coreapi:create_app not recognized

Usage:

    waitress-serve [OPTS] MODULE:OBJECT

Should I be calling waitress using python -m waitress --call CoreApi:create_app

Swatcat
  • 73
  • 6
  • 21
  • 57

1 Answers1

3

Change this:

CMD ["waitress-serve", "--call CoreApi:create_app"]

to this

CMD ["waitress-serve", "--call", "CoreApi:create_app"]

and it should work

qmeeus
  • 2,341
  • 2
  • 12
  • 21
  • Thank you, the stack overflow pages I looked at seemed to imply I needed to separate them, but your change fixed it. – Swatcat Oct 06 '19 at 12:32