This project is a simple example of how to use Fastapi with Docker.
docker build -t fastapi .
docker run -d --name fastapi_container -p 8002:8080 fastapi
curl http://localhost:8002
Bash output:
{"message":"Hello World"}
Go to url: http://localhost:8002
docker stop fastapi
docker rm fastapi
docker rmi fastapi
Go to url: http://localhost:8002/docs