From 4187a6c3d4269c4e5fe2b0afcf2d20a1c1b84693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phan=20V=C4=83n=20B=E1=BA=B1ng?= Date: Sun, 14 Jun 2026 12:28:19 +0700 Subject: [PATCH] docs: update Docker installation section to mention Docker Hub image The Docker installation docs previously only mentioned building from source. This update adds information about the official Docker Hub image (asyncapi/cli) which is the recommended approach for most users. Changes: - Add 'Using the official Docker Hub image' subsection (recommended) - Include docker pull commands for latest and specific versions - Add link to Docker Hub tags page - Add practical usage examples (validate, generate) - Move existing build-from-source instructions to a subsection Closes #1799 --- docs/installation.md | 47 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 6f9ccc60d..28a3844ed 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -47,28 +47,61 @@ To refresh the variables: ## Docker -Install [Docker](https://docs.docker.com/get-docker/) first, then use docker to build the image using the following command : -``` -docker build -t asyncapi/cli:latest . -``` -and run the image using the following command : +Install [Docker](https://docs.docker.com/get-docker/) first. There are two ways to use the AsyncAPI CLI with Docker: pulling the official image from Docker Hub (recommended) or building the image from source. +### Using the official Docker Hub image (recommended) + +The AsyncAPI CLI is available as an official image on [Docker Hub](https://hub.docker.com/r/asyncapi/cli). You can pull and use it directly without building from source. + +To pull the latest version: +```sh +docker pull asyncapi/cli +``` + +To pull a specific version: +```sh +docker pull asyncapi/cli:2.12.0 +``` + +You can find all available tags on the [Docker Hub tags page](https://hub.docker.com/r/asyncapi/cli/tags). + +To run the CLI using the Docker Hub image: ```bash docker run --rm -it \ --user=root \ -v [ASYNCAPI SPEC FILE LOCATION]:/app/asyncapi.yml \ -v [GENERATED FILES LOCATION]:/app/output \ asyncapi/cli [COMMAND HERE] +``` + +For example, to validate an AsyncAPI specification file: +```bash +docker run --rm -it \ +--user=root \ +-v ${PWD}/asyncapi.yml:/app/asyncapi.yml \ +asyncapi/cli validate /app/asyncapi.yml +``` -# Example that you can run inside the cli directory after cloning this repository. First, you specify the mount in the location of your AsyncAPI specification file and then you mount it in the directory where the generation result should be saved. +To generate output from a template: +```bash docker run --rm -it \ --user=root \ - -v ${PWD}/test/integration/fixtures/asyncapi_v1.yml:/app/asyncapi.yml \ + -v ${PWD}/asyncapi.yml:/app/asyncapi.yml \ -v ${PWD}/output:/app/output \ asyncapi/cli generate fromTemplate -o /app/output /app/asyncapi.yml @asyncapi/html-template --force-write ``` + Note: Use ``` ` ``` instead of `\` for Windows. +### Building from source + +If you prefer to build the Docker image from the source code, clone the repository and run: +```sh +docker build -t asyncapi/cli:latest . +``` + +Then run it using the same commands shown above. + ## Mac There are two ways to install the AsyncAPI CLI on your macOS: using the `brew` package manager or `pkg` files.