This is the most minimal image to run fastapi services.
Create the fastapi "hello world" application:
Write a main.py file in the current directory:
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
Launch the fastapi service
On windows:
docker run -v %CD%:/appsdir -p 127.0.0.1:9000:8000 --rm -ti cavallo71/upython-fastapi
or *nix:
docker run -v $(pwd):/appsdir -p 127.0.0.1:9000:8000 --rm -ti cavallo71/upython-fastapi
Connect opening the following url http://127.0.0.1:9000
Content type
Image
Digest
sha256:8d1280583…
Size
88.4 MB
Last updated
over 2 years ago
docker pull cavallo71/upython-fastapi