This project demonstrates how to:
- Create a FastAPI application.
- Containerize the application using Docker.
- Manage Docker containers.
- Set up a private Docker registry.
- Push images to Docker Hub.
- Docker installed on your machine.
- Docker Compose (optional, for multi-container setups).
- Basic understanding of Docker and FastAPI.
On Ubuntu (via WSL2):
** Install venv for Linux:- sudo apt-get install python3-venv** Create virtual environment:- py -m venv venv Activate virtual env for Linux:- source venv/bin/activate Activate virtual env for Windows:- .\venv\Scripts\activate
docker run hello-world
###3. Use this command to build the docker image from Dockerfile docker build -t fastapi-app .
###4. Run the docker container form image docker run -d -p 80:80 fastapi-app access the webapp by entering this "localhost:80/docs" to browser
###5. To start, stop, remove and list containers docker start <container_id> docker stop <container_id> docker rm <container_id> docker ps
###6. Dokcer compose command to create image docker run -d -p 80:80 fastapi-app access the webapp by entering this "localhost:80/docs" to browser
###7.Push an image to private registry docker login docker tag fastapi-app localhost:8000/fastapi-app:latest docker push localhost:8000/fastapi-app:latest