SafeQR FastAPI Application
This repository contains the SafeQR FastAPI application, which is packaged as a Docker image. This document provides instructions on how to build, run, and stop the Docker container for this application.
Prerequisites
- Docker: Ensure Docker is installed on your system. You can download it from Docker's official website.
Build the Docker Image
If you haven't built the Docker image yet, you can do so with the following command:
docker build -t safeqr-fastapi-app .
Run the Docker Container
To run the Docker container from the image, use the following command:
docker run -d -p 8000:8000 safeqr-fastapi-app
This will start the FastAPI application in a Docker container, making it accessible at http://localhost:8000.
Stop/Kill the Docker Container
To stop the running container, first, find the container ID:
docker ps
This command lists all running containers. Find the CONTAINER ID for safeqr-fastapi-app.
To stop the container, use:
docker stop <container_id>
Replace <container_id> with the actual ID of your container.
If you want to remove the container entirely after stopping it:
docker rm <container_id>
Accessing the Application Logs
If you need to view the logs of the running container, use:
docker logs <container_id>
Removing the Docker Image
If you need to remove the Docker image, use the following command:
docker rmi safeqr-fastapi-app
This will remove the Docker image from your local machine.
Troubleshooting
-
Port Conflict: If port 8000 is already in use, you can change the port mapping. For example, to map the container's port 8000 to port 8080 on your machine, use:
docker run -d -p 8080:8000 safeqr-fastapi-app -
Container Already Running: If you get an error that the container is already running, stop the existing container as shown above.