Forum Discussion
Thanks for posting your steps Ray!
From a quick look, you could skip the hosting of the swagger.json, if your spec was public on SwaggerHub...
docker run -p 80:8080 -e API_URL="https://api.swaggerhub.com/apis/ponelat/limoncello/1.0.0" swaggerapi/swagger-ui
> Note: api.swaggerhub.com, for the API and app.swaggerhub.com web UI.
See: https://app.swaggerhub.com/apis/swagger-hub/registry-api/1.0.45 for ways of getting your spec.
Thanks for making the point that the JSON is also accessible directly from a published instance directly on SwaggerHub. I should have added that I'm not ready to publish it and I'd like to restrict who has access to the API docs by IP address. By self-hosting the JSON, I have much more control over that.
--Ray
- ponelat7 years agoStaff
Hey Ray, that's understandable.
For SWAGGER_JSON there is confusion around the `-v` flag of docker ( it stands for volume, and is a way to mount a filesystem/file ).
See this thread for more info https://github.com/swagger-api/swagger-ui/issues/3348
tl;dr...
docker run -p 80:8080 -e "SWAGGER_JSON=/swagger.json" -v /home/josh/swagger.json:/swagger.json swaggerapi/swagger-ui
Replace `/home/josh/swagger.json` with the path to your swagger.json on your server/laptop.
For private specs in SwaggerHub, you can access them with an APIKEY, but the Open Source swaggerui docker image doesn't have a mechanism for that (yet).
- RayRenteria7 years agoNew Contributor
Ah! Thanks for that! I've updated my instructions above to reflect your feedback. Thanks for your help!
--Ray
Related Content
Recent Discussions
- 14 days agotobyclements