redoc/config/docker
Alex Varchuk 10400113fb
feat: initialize release candidate for v3.0.0
Co-authored-by: Roman Hotsiy <gotsijroman@gmail.com>
Co-authored-by: Alex Varchuk <olexandr.varchuk@gmail.com>
Co-authored-by: Oprysk Vyacheslav <vyacheslav@redocly.com>
Co-authored-by: Ivan Kropyvnytskyi <130547411+ivankropyvnytskyi@users.noreply.github.com>
Co-authored-by: Yevhen Pylyp <yevhen.pylyp@redocly.com>
Co-authored-by: Vladyslav Makarenko <vladyslav.makarenko@redocly.com>
Co-authored-by: Yevhenii Medviediev <yevhenii.medviediev@redocly.com>
Co-authored-by: Oleksii Horbachevskyi <oleksii.horbachevskyi@redocly.com>
Co-authored-by: volodymyr-rutskyi <rutskyi.v@gmail.com>
Co-authored-by: Adam Altman <adam@redoc.ly>
Co-authored-by: Andrew Tatomyr <andrew.tatomyr@redocly.com>
Co-authored-by: Anastasiia Derymarko <anastasiia@redocly.com>
Co-authored-by: Roman Marshevskyy <roman.marshevskyy@redoc.ly>
Co-authored-by: Lorna Mitchell <lorna.mitchell@redocly.com>
Co-authored-by: Taylor Krusen <taylor.krusen@redocly.com>
2025-10-24 17:55:59 +02:00
..
docker-entrypoint.d feat: initialize release candidate for v3.0.0 2025-10-24 17:55:59 +02:00
nginx feat: initialize release candidate for v3.0.0 2025-10-24 17:55:59 +02:00
static feat: initialize release candidate for v3.0.0 2025-10-24 17:55:59 +02:00
Dockerfile feat: initialize release candidate for v3.0.0 2025-10-24 17:55:59 +02:00
README.md feat: initialize release candidate for v3.0.0 2025-10-24 17:55:59 +02:00

Official Redoc Docker Image

Usage

Docker

Serve remote spec by URL:

docker run -it --rm -p 80:80 \
  -e SPEC_URL='http://localhost:8000/swagger.yaml' redocly/redoc

Serve local file:

docker run -it --rm -p 80:80 \
  -v $(pwd)/demo/swagger.yaml:/usr/share/nginx/html/swagger.yaml \
  -e SPEC_URL=swagger.yaml redocly/redoc

Serve local file and watch for updates:

docker run -it --rm -p 80:80 \
  -v $(pwd)/demo/:/usr/share/nginx/html/swagger/ \
  -e SPEC_URL=swagger/swagger.yaml redocly/redoc

OpenShift

To quote OpenShift Container Platform-Specific Guidelines:

Support Arbitrary User IDs

By default, OpenShift Container Platform runs containers using an arbitrarily assigned user ID. This provides additional security against processes escaping the container due to a container engine vulnerability and thereby achieving escalated permissions on the host node.

For an image to support running as an arbitrary user, directories and files that may be written to by processes in the image should be owned by the root group and be read/writable by that group. Files to be executed should also have group execute permissions.

To comply with those requirements the Dockerfile contains instructions to adapt the rights for the folders:

  • /etc/nginx because the docker-run.sh script modifies it at startup time
  • /usr/share/nginx/html because the docker-run.sh script modifies it at startup time
  • /var/cache/nginx because the Nginx process writes to it
  • /var/log/nginx because the Nginx process writes to it
  • /var/run because the Nginx process writes to it

Another issue with OpenShift is that the default exposed port 80 cannot be used as it is restricted. So one needs to use another port like 8080 (using the PORT configuration as described below), and then to configure the container spec accordingly.

Runtime configuration options

  • PAGE_TITLE (default "ReDoc") - page title
  • PAGE_FAVICON (default "favicon.png") - URL to page favicon
  • BASE_PATH (optional) - path prefix
  • SPEC_URL (default "http://petstore.swagger.io/v2/swagger.json") URL to the spec (if mounted as a file inside the container and BASE_PATH is used, the spec should contain the prefix, e.g., for "/v1/swagger.json")
  • HOST (default localhost) - nginx server_name
  • PORT (default 80) - nginx port
  • REDOC_OPTIONS (optional) - <redoc> tag attributes

Build

docker build -t redocly/redoc .