Swatcat
Swatcat

Reputation: 55

Deployment of Flask based Api (using waitress) to Docker

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

Upvotes: 3

Views: 7070

Answers (1)

qmeeus
qmeeus

Reputation: 2402

Change this:

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

to this

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

and it should work

Upvotes: 4

Related Questions