Welcome to the FastAPI Hello World project! This repository is a beginner-friendly guide to getting started with FastAPI and Docker. We'll walk you through the basics of setting up a FastAPI application, containerizing it with Docker, and running it locally. 🚀
- Introduction
- Prerequisites
- Setup Instructions
- Testing the Application
- Troubleshooting
- Learn More
- Contributing
- License
FastAPI is a modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints. This repository contains a simple "Hello World" application to help you get started with FastAPI and Docker.
Before you begin, make sure you have the following installed:
- Docker: Get Docker
- Git: Get Git
Follow these simple steps to set up the project on your local machine:
First, clone the repository to your local machine:
git clone https://github.com/moyed/fastapi-docker.git
cd fastapi-docker
Next, build the Docker image for the FastAPI application:
docker build -t fastapi-hello-world .
Once the image is built, run the Docker container:
docker run -d -p 8000:8000 fastapi-hello-world
Now that your application is running, it’s time to test it! 🎉
Open your web browser and go to:
http://localhost:8000
You should see a “Hello World” message displayed. Congratulations, you’re up and running with FastAPI and Docker! 🎊
If you run into any issues, here are some common troubleshooting steps:
- Docker Build Issues: Ensure Docker is running and you’re in the correct directory.
- Port Conflicts: Make sure port 8000 is not being used by another application.
- Network Issues: Check your Docker network settings if you can’t access the application.
Want to dive deeper into FastAPI and Docker? Check out these resources:
- Docker: Docker Documentation
- FastAPI: FastAPI Documentation
We welcome contributions! If you have suggestions for improvements, feel free to open an issue or submit a pull request. Let’s make this project even better together! 🤝
This project is licensed under the MIT License - see the LICENSE file for details.