Skip to main content

Quick start

Pull and run the latest image from Docker Hub:
docker run --rm -p 8787:8787 portkeyai/gateway:latest
The gateway is now listening on http://localhost:8787.
The --rm flag removes the container when it stops. Remove it if you want the container to persist across restarts.

Docker Compose

Use Docker Compose for a managed, restart-on-failure setup.
1

Download the Compose file

wget "https://raw.githubusercontent.com/Portkey-AI/gateway/main/docker-compose.yaml"
2

Start the service

docker compose up -d
The service starts in the background and listens on port 8787. The restart: always policy ensures it restarts automatically on failure or reboot.
The docker-compose.yaml used by the command above:
docker-compose.yaml
version: '3'
services:
  web:
    ports:
      - "8787:8787"
    image: "portkeyai/gateway:latest"
    restart: always

Build from source

Build your own image from the repository if you need to modify the gateway code or pin a specific commit.
1

Clone the repository

git clone https://github.com/portkey-ai/gateway
cd gateway
2

Build the image

docker build -t portkey-gateway .
The Dockerfile uses a multi-stage build: a node:20-alpine build stage compiles the project, then a second node:20-alpine stage copies only the production artifacts to keep the final image small.
3

Run the image

docker run --rm -p 8787:8787 portkey-gateway
The Dockerfile for reference:
Dockerfile
# Build stage
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
COPY patches ./
RUN apk upgrade --no-cache
RUN npm install -g [email protected]
RUN npm install
COPY . .
RUN npm run build \
  && rm -rf node_modules \
  && npm install --omit=dev

# Runtime stage
FROM node:20-alpine
RUN apk upgrade --no-cache
RUN npm install -g [email protected]
WORKDIR /app
COPY --from=build /app/build /app/build
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/patches /app/patches
EXPOSE 8787
ENTRYPOINT ["npm"]
CMD ["run", "start:node"]

Environment variables and configuration

Mount a conf.json file to configure integrations, credentials, plugins, and caching:
docker run --rm -p 8787:8787 \
  -v $(pwd)/conf.json:/app/conf.json \
  portkeyai/gateway:latest
For Redis-backed caching, pass the connection string as an environment variable:
docker run --rm -p 8787:8787 \
  -e REDIS_CONNECTION_STRING=redis://your-redis-host:6379 \
  -v $(pwd)/conf.json:/app/conf.json \
  portkeyai/gateway:latest
See the configuration reference for the full conf.json schema and all supported environment variables.

Build docs developers (and LLMs) love