"FastAPI Hello World" docker image API built with FastAPI and Python on the default port 8080.
4.0K
"Hello World" API docker image built using FastAPI and Python
docker run -it --rm --network host raushanraja/fastapi-hello-world:latest
This application uses the following environment variables, which can be customized:
HOST: (Default: 0.0.0.0) - The default host address.PORT: (Default: 8080) - The default port number.RELOAD: (Default: True) - A boolean indicating whether reload is enabled (True or False).Run the Docker container with customized configuration:
docker run -e HOST="YOUR_HOST" -e PORT="YOUR_PORT" -e RELOAD="YOUR_RELOAD_VALUE" raushanraja/fastapi-hello-world:latest
Replace YOUR_HOST, YOUR_PORT, and YOUR_RELOAD_VALUE with your desired values.
HOST: Specify the desired host address.PORT: Specify the port number.RELOAD: Set to True or False based on your requirements.Run using docker-comopose:
version: '3'
services:
fastapi:
image: raushanraja/fastapi-hello-world:latest
ports:
- "8080:8080"
environment:
- HOST=0.0.0.0
- PORT=8080
- RELOAD=False
docker-compose up
http://localhost:8080/{
"message": "Hello World",
"method": "GET"
}
http://localhost:8080/{
"message": "Hello World",
"method": "POST"
}
http://localhost:8080/{
"message": "Hello World",
"method": "PUT"
}
http://localhost:8080/{
"message": "Hello World",
"method": "DELETE"
}
http://localhost:8080/{
"message": "Hello World",
"method": "PATCH"
}
http://localhost:8080/{
"message": "Hello World",
"method": "OPTIONS"
}
http://localhost:8080/{
"message": "Hello World",
"method": "HEAD"
}
http://localhost:8080/{
"message": "Hello World",
"method": "TRACE"
}
Content type
Image
Digest
sha256:8a0d13082…
Size
70.8 MB
Last updated
almost 3 years ago
docker pull raushanraja/fastapi-hello-world