Open a-ajay opened 5 years ago
Have you checked the documentation on running it as a docker image? https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/installation.md#docker
That also has a link as to how to configure Swagger UI inside the docker image, including running it with multiple files.
Thanks, @webron - I found the link very useful. Now I have one more issue, Below is the command, I'm using it to run multiple files on swagger
docker run -d -p 80:8080 -e URLS="[{name:\"v20\", url:\"/foo/v20.yaml\"}, {name:\"v21\", url:\"/foo/v21.yaml\"},{name:\"v22\", url:\"/foo/v22.yaml\"}]" -v /home:/foo swaggerapi/swagger-ui
But the YAML files are in local machine, how do I provide its URL?
Current now, I use this way to work around.
Dockerfile:
FROM swaggerapi/swagger-ui
COPY ./*.yml /usr/share/nginx/html/
ENV URLS "[{url:\"/Sample1.yml\",name:\"Sample1\"},{url:\"/Sample2.yml\",name:\"Sample2\"}]"
step1: docker build -t apis:v1 .
step2: docker run -p 82:8080 apis:v1
step3: http://<ip>:82
This issue can be closed I think, it is fixed with #5565
An other workaround solution:
docker run -d -p 80:8080 -e URLS='[{url: "v20.yaml", name: "v20"},{url: "v21.yaml", name: "v21"}]' -v /home/v20.yaml:/usr/share/nginx/html/v20.yaml -v /home/v21.yaml:/usr/share/nginx/html/v21.yaml swaggerapi/swagger-ui
Q&A (please complete the following information)
Content & configuration
I use the below command to run docker locally on my machine:
docker run -d -p 80:8080 -e SWAGGER_JSON=/foo/v210.yaml -v /home/mydir:/foo swaggerapi/swagger-ui
v210.yaml is the YAML file, I have 2 more of them. Now,
Please let me know the docker command to do this.