Skip to content

Instantly share code, notes, and snippets.

@mydiemho
Created December 2, 2020 18:00
Show Gist options
  • Save mydiemho/306559207fc8ff0137aed9a1ccf38b6c to your computer and use it in GitHub Desktop.
Save mydiemho/306559207fc8ff0137aed9a1ccf38b6c to your computer and use it in GitHub Desktop.
The [instruction](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/installation.md#docker)
for mounting is confusing so adding extra info on how to run it
1. Download `swagger-ui` [Docker image](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/installation.md#docker)
```bash
docker pull swaggerapi/swagger-ui
```
1. Make sure you're in the directory that contains `swagger.json`
1. Start Nginx on port `80`
```bash
# detach mode
docker run --name swagger -d -p 80:8080 -e SWAGGER_JSON=/app/swagger.json -v "$(pwd)":/app swaggerapi/swagger-ui
```
```bash
# it will look like the command hangs but if there's no error then it's working -___-
docker run -p 80:8080 -e SWAGGER_JSON=/app/swagger.json -v "$(pwd)":/app swaggerapi/swagger-ui
```
1. Go to browser and access `http://localhost:80`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment