Skip to content
Platform Status

CLI

Using Speakeasy with Docker

The Speakeasy Docker image provides a containerized environment for running Speakeasy CLI commands. The image does not include language toolchains, so it cannot be used for SDK generation. Use it for other tasks like validating OpenAPI specs, checking SDK status, and running quickstart commands.

The official Speakeasy Docker image is available on GitHub Container Registry:

ghcr.io/speakeasy-api/speakeasy

Pull the latest Speakeasy Docker image:

Terminal window
docker pull ghcr.io/speakeasy-api/speakeasy:latest

You can also use specific version tags instead of latest for reproducible builds:

Terminal window
docker pull ghcr.io/speakeasy-api/speakeasy:v1.234.0

To authenticate with the Speakeasy Platform from within a Docker container, you need to:

  1. Set the SPEAKEASY_LOGIN_CALLBACK_PORT environment variable
  2. Expose the callback port for OAuth authentication
  3. Mount your workspace directory
Terminal window
docker run -it -v "$(pwd):/workspace" -w "/workspace" \
-e SPEAKEASY_LOGIN_CALLBACK_PORT=$SPEAKEASY_LOGIN_CALLBACK_PORT \
-p $SPEAKEASY_LOGIN_CALLBACK_PORT:$SPEAKEASY_LOGIN_CALLBACK_PORT \
ghcr.io/speakeasy-api/speakeasy:latest auth login

After running this command, a browser window will open for you to authenticate with the Speakeasy Platform.

For automated environments like CI/CD pipelines, use an API key instead of interactive authentication:

Terminal window
docker run -it -v "$(pwd):/workspace" -w "/workspace" \
-e SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY \
ghcr.io/speakeasy-api/speakeasy:latest run

Create an API key in the Speakeasy Platform and set it as the SPEAKEASY_API_KEY environment variable.

Get started with an interactive quickstart:

Terminal window
docker run -it -v "$(pwd):/workspace" -w "/workspace" \
ghcr.io/speakeasy-api/speakeasy:latest quickstart

Validate your OpenAPI specification:

Terminal window
docker run -it -v "$(pwd):/workspace" -w "/workspace" \
ghcr.io/speakeasy-api/speakeasy:latest validate openapi -s ./openapi.yaml

Check the status of your SDK generation:

Terminal window
docker run -it -v "$(pwd):/workspace" -w "/workspace" \
ghcr.io/speakeasy-api/speakeasy:latest status

The Docker image is designed for use in CI/CD pipelines. Here’s an example GitHub Actions workflow for validating an OpenAPI spec:

name: Validate OpenAPI
on:
push:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate OpenAPI spec
run: |
docker run -v "$(pwd):/workspace" -w "/workspace" \
ghcr.io/speakeasy-api/speakeasy:latest validate openapi -s ./openapi.yaml

When using the Docker image, ensure that:

  1. Your workspace directory is mounted to /workspace
  2. The working directory is set to /workspace with -w "/workspace"
  3. File permissions allow the container to read and write files

If you encounter permission issues, you may need to adjust file ownership or run the container with appropriate user permissions.

If authentication fails, ensure that:

  • The callback port is properly exposed with -p
  • The SPEAKEASY_LOGIN_CALLBACK_PORT environment variable is set
  • Your firewall allows connections on the callback port

If file permission errors occur, try running the container with the appropriate user ID:

Terminal window
docker run -it --user $(id -u):$(id -g) \
-v "$(pwd):/workspace" -w "/workspace" \
ghcr.io/speakeasy-api/speakeasy:latest validate openapi -s ./openapi.yaml

Ensure the Docker container has network access to:

  • The Speakeasy Platform (app.speakeasy.com)
  • The OpenAPI specification source (if remote)