Skip to content

Learn how to Dockerize a Python application using fastapi framework with this basic ‘Hello, World!’

Notifications You must be signed in to change notification settings

moyed/fastapi-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Hello World 🌍

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. 🚀

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Setup Instructions
  4. Testing the Application
  5. Troubleshooting
  6. Learn More
  7. Contributing
  8. License

Introduction

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.

Prerequisites

Before you begin, make sure you have the following installed:

Setup Instructions

Follow these simple steps to set up the project on your local machine:

1. Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/moyed/fastapi-docker.git
cd fastapi-docker

2. Build the Docker Image

Next, build the Docker image for the FastAPI application:

docker build -t fastapi-hello-world . 

3. Run the Docker Container

Once the image is built, run the Docker container:

docker run -d -p 8000:8000 fastapi-hello-world

Testing the Application

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! 🎊

Troubleshooting

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.

Learn More

Want to dive deeper into FastAPI and Docker? Check out these resources:

Contributing

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! 🤝

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Learn how to Dockerize a Python application using fastapi framework with this basic ‘Hello, World!’

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published