I have spring doc in java that generates swagger using the url http://localhost:8080/swagger-ui/index.html with base url /v3/api-docs but when using docker it doesn’t work.
So I decided to use the image version of swagger-ui in docker compose as shown below
services:
subscription-manager_app:
container_name: subscription-manager_app
image: hizam/subscription-manager_app:1.0.0
build: .
ports:
- '8080:8080'
environment:
DATABASE_URL: jdbc:postgresql://db:5432/subscription-manager
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: 1
depends_on:
- db
- swagger
swagger:
container_name: swagger_con
image: swaggerapi/swagger-ui:v5.19.0
ports:
- '80:8080'
db:
container_name: db
image: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1
POSTGRES_DB: subscription-manager
ports:
- '5333:5432'
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata: { }
The swagger swagger-ui:v5.19.0 generates json with the url localhost
with base url https://petstore.swagger.io/v2/swagger.json.
I have red the documentation about swagger-ui image it but I couldn’t find info that explains this case.
If you faced the same issue let me know.