Skip to content

Commit

Permalink
fix(docker): document new SwaggerEditor@4 docker registry usage (#5350)
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Jan 29, 2025
1 parent cdc7491 commit 212d2c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'docker.io/swaggerapi/swagger-editor:unstable'
image-ref: 'docker.swagger.io/swaggerapi/swagger-editor:unstable'
format: 'table'
exit-code: '1'
ignore-unfixed: true
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,47 +121,48 @@ To help with the migration, here are the currently known issues with 3.X. This l
## Docker

### Running the image from DockerHub
There is a docker image published in [DockerHub](https://hub.docker.com/r/swaggerapi/swagger-editor/).

There is a docker image published in **docker.swagger.io** registry.

To use this, run the following:

```
docker pull swaggerapi/swagger-editor
docker run -d -p 80:8080 swaggerapi/swagger-editor
docker pull docker.swagger.io/swaggerapi/swagger-editor
docker run -d -p 80:8080 docker.swagger.io/swaggerapi/swagger-editor
```

This will run Swagger Editor (in detached mode) on port 80 on your machine, so you can open it by navigating to `http://localhost` in your browser.

* You can provide a URL pointing to an API definition (may not be available if some security policies such as CSP or CORS are enforced):

```
docker run -d -p 80:8080 -e URL="https://petstore3.swagger.io/api/v3/openapi.json" swaggerapi/swagger-editor
docker run -d -p 80:8080 -e URL="https://petstore3.swagger.io/api/v3/openapi.json" docker.swagger.io/swaggerapi/swagger-editor
```

* You can provide your own `json` or `yaml` definition file from your local host:

```
docker run -d -p 80:8080 -v $(pwd):/tmp -e SWAGGER_FILE=/tmp/swagger.json swaggerapi/swagger-editor
docker run -d -p 80:8080 -v $(pwd):/tmp -e SWAGGER_FILE=/tmp/swagger.json docker.swagger.io/swaggerapi/swagger-editor
```

**Note:** When both `URL` and `SWAGGER_FILE` environment variables are set, `URL` has priority and `SWAGGER_FILE` is ignored.

* You can specify a different base url via `BASE_URL` variable for accessing the application - for example if you want the application to be available at `http://localhost/swagger-editor/`:

```
docker run -d -p 80:8080 -e BASE_URL=/swagger-editor swaggerapi/swagger-editor
docker run -d -p 80:8080 -e BASE_URL=/swagger-editor docker.swagger.io/swaggerapi/swagger-editor
```

* You can specify a different port via `PORT` variable for accessing the application, default is `8080`.

```
docker run -d -p 80:80 -e PORT=80 swaggerapi/swagger-editor
docker run -d -p 80:80 -e PORT=80 docker.swagger.io/swaggerapi/swagger-editor
```

* You can specify Google Tag Manager ID via `GTM` variable for tracking the usage of the swagger-editor.

```
docker run -d -p 80:8080 -e GTM=GTM-XXXXXX swaggerapi/swagger-editor
docker run -d -p 80:8080 -e GTM=GTM-XXXXXX docker.swagger.io/swaggerapi/swagger-editor
```

You can also customize the different endpoints used by the Swagger Editor with the following environment variables. For instance, this can be useful if you have your own Swagger generator server:
Expand Down

0 comments on commit 212d2c6

Please sign in to comment.