Skip to main content
CLI Proxy API provides official Docker images and Docker Compose configurations for easy deployment.

Quick Start

1

Pull the Docker image

docker pull eceasy/cli-proxy-api:latest
2

Create configuration file

Create a config.yaml file based on the example configuration:
port: 8317
log_level: info
# Add your configuration here
3

Run the container

docker run -d \
  --name cli-proxy-api \
  -p 8317:8317 \
  -v $(pwd)/config.yaml:/CLIProxyAPI/config.yaml \
  -v $(pwd)/auths:/root/.cli-proxy-api \
  -v $(pwd)/logs:/CLIProxyAPI/logs \
  eceasy/cli-proxy-api:latest

Docker Compose Deployment

For production environments, use Docker Compose for easier management.

Using Pre-built Image

1

Create docker-compose.yml

docker-compose.yml
services:
  cli-proxy-api:
    image: eceasy/cli-proxy-api:latest
    pull_policy: always
    container_name: cli-proxy-api
    environment:
      DEPLOY: ${DEPLOY:-}
    ports:
      - "8317:8317"
      - "8085:8085"
      - "1455:1455"
      - "54545:54545"
      - "51121:51121"
      - "11451:11451"
    volumes:
      - ${CLI_PROXY_CONFIG_PATH:-./config.yaml}:/CLIProxyAPI/config.yaml
      - ${CLI_PROXY_AUTH_PATH:-./auths}:/root/.cli-proxy-api
      - ${CLI_PROXY_LOG_PATH:-./logs}:/CLIProxyAPI/logs
    restart: unless-stopped
2

Start the service

docker compose up -d
3

View logs

docker compose logs -f

Building from Source

To build the Docker image from source:
1

Clone the repository

git clone https://github.com/router-for-me/CLIProxyAPI.git
cd CLIProxyAPI
2

Build with version information

export CLI_PROXY_IMAGE="cli-proxy-api:local"
VERSION="$(git describe --tags --always --dirty)"
COMMIT="$(git rev-parse --short HEAD)"
BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"

docker compose build \
  --build-arg VERSION="${VERSION}" \
  --build-arg COMMIT="${COMMIT}" \
  --build-arg BUILD_DATE="${BUILD_DATE}"
3

Start the service

docker compose up -d --remove-orphans --pull never
Alternatively, use the provided build script:
./docker-build.sh
The script will prompt you to:
  1. Run using pre-built image (recommended)
  2. Build from source and run (for developers)

Volume Mounts

The container uses three volume mounts:
VolumePath in ContainerPurpose
Configuration/CLIProxyAPI/config.yamlMain configuration file
Authentication/root/.cli-proxy-apiOAuth tokens and credentials
Logs/CLIProxyAPI/logsApplication logs

Configuration Volume

Mount your config.yaml file:
-v /path/to/config.yaml:/CLIProxyAPI/config.yaml

Authentication Volume

Store OAuth tokens and credentials:
-v /path/to/auths:/root/.cli-proxy-api

Logs Volume

Persist application logs:
-v /path/to/logs:/CLIProxyAPI/logs

Environment Variables

Docker Compose Variables

Customize deployment with environment variables:
export CLI_PROXY_IMAGE="eceasy/cli-proxy-api:v6.0.0"
export CLI_PROXY_CONFIG_PATH="./config.yaml"
export CLI_PROXY_AUTH_PATH="./auths"
export CLI_PROXY_LOG_PATH="./logs"
export DEPLOY="cloud"

docker compose up -d

Build Arguments

When building from source:
ArgumentDescriptionDefault
VERSIONVersion tagdev
COMMITGit commit hashnone
BUILD_DATEBuild timestampunknown

Network Configuration

Exposed Ports

The default configuration exposes multiple ports:
  • 8317 - Main API server (default)
  • 8085 - Additional service port
  • 1455 - Additional service port
  • 54545 - Additional service port
  • 51121 - Additional service port
  • 11451 - Additional service port
Customize ports in your docker-compose.yml or with -p flags:
docker run -p 9000:8317 ...

Timezone Configuration

The container sets timezone to Asia/Shanghai by default. The Dockerfile includes:
ENV TZ=Asia/Shanghai
RUN cp /usr/share/zoneinfo/${TZ} /etc/localtime && echo "${TZ}" > /etc/timezone
Override with the TZ environment variable:
docker run -e TZ=America/New_York ...

Docker Build Script Features

The docker-build.sh script provides additional features:

Usage Statistics Preservation

Preserve usage statistics across container rebuilds:
./docker-build.sh --with-usage
On first run, you’ll be prompted for the management API key. The script:
  1. Exports usage statistics before stopping the container
  2. Rebuilds/restarts the container
  3. Imports statistics back into the new container
The API key is stored in temp/stats/.api_secret for subsequent runs.

Health Check

Verify the service is running:
curl http://localhost:8317/

Container Management

View Logs

# All logs
docker compose logs -f

# Last 100 lines
docker compose logs --tail=100

Stop the Service

docker compose down

Restart the Service

docker compose restart

Update to Latest Version

docker compose pull
docker compose up -d

Next Steps

Cloud Deployment

Deploy in cloud environments with advanced configuration

Storage Backends

Configure PostgreSQL, Git, or Object Storage backends

Build docs developers (and LLMs) love