Swagger running with local json file in Docker Image

For me following command helped

docker run -p 8081:8080 -e SWAGGER_JSON=/tmp/swagger.json -v `pwd`/docs:/tmp swaggerapi/swagger-ui:v3.21.0

'pwd'/docs => Contains my swagger.json file.

swaggerapi/swagger-ui:v3.21.0 => This version is supported SWAGGER_JSON.Its tested.


The way it worked for me on Windows is this:

docker run -p 80:8080 -e SWAGGER_JSON=/mnt/swagger-v1.json -v C:\Users\jimen\Downloads:/mnt swaggerapi/swagger-ui

where C:\Users\jimen\Downloads is the folder where the local swagger file is located (swagger-v1.json).

enter image description here


I actually wanted swagger-editor and not swaggerapi/swagger-ui:

docker pull swaggerapi/swagger-editor
docker run -p 7999:8080 swaggerapi/swagger-editor 

Then you get a full File menu:

Before I had a pull the


In the docker command -v means to mount a volume and -e means to add environment variables, so what you want is probbably this:

docker run -p 8081:8080 -e SWAGGER_JSON=/mnt/lp.json -v /Users/abc/Desktop:/mnt swaggerapi/swagger-ui