done
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
# Flask API with Swagger in Docker
|
||||
|
||||
This repository contains a Flask API with Swagger documentation, running inside Docker containers.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Ensure you have the following installed:
|
||||
|
||||
- [Docker](https://www.docker.com/get-started)
|
||||
- [Docker Compose](https://docs.docker.com/compose/install/)
|
||||
|
||||
### Clone the Repository
|
||||
|
||||
```sh
|
||||
git clone <your-repo-url>
|
||||
cd <your-repo-folder>
|
||||
```
|
||||
|
||||
### Setup and Run the Application
|
||||
|
||||
#### 1. Build and Start the Containers
|
||||
|
||||
```sh
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
- Build the Flask API container.
|
||||
- Start the Swagger UI container separately.
|
||||
|
||||
#### 2. Verify the Containers are Running
|
||||
|
||||
```sh
|
||||
docker ps
|
||||
```
|
||||
|
||||
#### 3. Access the API
|
||||
|
||||
- The **Flask API** will be available at:
|
||||
```
|
||||
http://localhost:5000
|
||||
```
|
||||
- The **Swagger UI** will be available at:
|
||||
```
|
||||
http://localhost:9000
|
||||
```
|
||||
You can interact with the API documentation and test endpoints from here.
|
||||
|
||||
## Making API Requests
|
||||
|
||||
You can send requests using tools like `curl` or Postman:
|
||||
|
||||
```sh
|
||||
curl -X GET http://localhost:5000/hello
|
||||
```
|
||||
|
||||
## Stopping the Application
|
||||
|
||||
To stop the running containers, use:
|
||||
|
||||
```sh
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If there are permission issues, try running Docker commands with `sudo`.
|
||||
- If ports are in use, change them in `docker-compose.yml`.
|
||||
- To rebuild the containers, use:
|
||||
```sh
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user