DS2API Docker Compose Setup
DS2API Docker Compose Setup
This note records a DS2API deployment with Docker Compose.
Example values:
- public domain:
ds2api.example.com - public HTTPS port:
8446 - app port inside container:
5001 - host port bound to localhost:
6011 - admin key:
example_ds2api_admin_key_change_me - API key:
sk-example-ds2api-key-please-change
All keys above are fake.
Clone
1 | git clone https://github.com/CJackHwang/ds2api.git |
Environment
Edit .env:
1 | PORT=5001 |
The app listens on PORT inside the container.
DS2API_HOST_PORT is the host-side port used by Docker
Compose.
Prefer binding the host port to localhost:
1 | ports: |
config.json
Minimal example:
1 | { |
DeepSeek account passwords and refresh tokens are credentials. Treat
config.json as a secret file.
Start
1 | docker compose up -d |
Check logs:
1 | docker logs --tail 200 -f ds2api |
Caddy Reverse Proxy
1 | ds2api.example.com:8446 { |
Reload:
1 | sudo caddy validate --config /etc/caddy/Caddyfile |
Open the firewall port if needed:
1 | sudo nft add rule inet filter input tcp dport 8446 accept |
Test
1 | curl https://ds2api.example.com:8446/v1/models \ |
Chat completion:
1 | curl https://ds2api.example.com:8446/v1/chat/completions \ |
Notes
- Change
DS2API_ADMIN_KEY; do not leave a default admin password. - Keep
config.jsonprivate because it stores upstream account credentials. - Bind the service to
127.0.0.1and publish it through Caddy. - Do not paste real
sk-...keys into public docs.