A production-ready, hardened Docker image for Strapi CMS.
621
A production-ready, hardened Docker image for Strapi CMS - an open-source headless CMS built with Node.js.
docker run -d \
-p 1337:1337 \
-e NODE_ENV=production \
--name strapi \
kubekanvas/strapi:latest
docker run -d \
-p 1337:1337 \
-e NODE_ENV=production \
-e ADMIN_JWT_SECRET=your-secret-here \
-e API_TOKEN_SALT=your-salt-here \
-e APP_KEYS=key1,key2 \
--name strapi \
kubekanvas/strapi:latest
docker run -d \
-p 1337:1337 \
-e NODE_ENV=production \
-v strapi-data:/opt/app/.tmp \
-v strapi-uploads:/opt/app/public/uploads \
--name strapi \
kubekanvas/strapi:latest
| Variable | Description | Required |
|---|---|---|
NODE_ENV | Environment mode (production/development) | No (default: production) |
HOST | Server host | No (default: 0.0.0.0) |
PORT | Server port | No (default: 1337) |
ADMIN_JWT_SECRET | JWT secret for admin panel | Yes |
API_TOKEN_SALT | Salt for API tokens | Yes |
APP_KEYS | Application keys (comma-separated) | Yes |
TRANSFER_TOKEN_SALT | Salt for transfer tokens | Yes |
JWT_SECRET | JWT secret | Yes |
ENCRYPTION_KEY | Encryption key | Yes |
| Variable | Description | Default | Required |
|---|---|---|---|
DATABASE_CLIENT | Database type: sqlite, mysql, or postgres | sqlite | No |
| Variable | Description | Default |
|---|---|---|
DATABASE_FILENAME | Database file path | .tmp/data.db |
| Variable | Description | Default | Required |
|---|---|---|---|
DATABASE_HOST | MySQL host | localhost | Yes |
DATABASE_PORT | MySQL port | 3306 | No |
DATABASE_NAME | Database name | strapi | Yes |
DATABASE_USERNAME | Database user | strapi | Yes |
DATABASE_PASSWORD | Database password | - | Yes |
DATABASE_SSL | Enable SSL | false | No |
DATABASE_POOL_MIN | Min pool connections | 2 | No |
DATABASE_POOL_MAX | Max pool connections | 10 | No |
| Variable | Description | Default | Required |
|---|---|---|---|
DATABASE_HOST | PostgreSQL host | localhost | Yes |
DATABASE_PORT | PostgreSQL port | 5432 | No |
DATABASE_NAME | Database name | strapi | Yes |
DATABASE_USERNAME | Database user | strapi | Yes |
DATABASE_PASSWORD | Database password | - | Yes |
DATABASE_URL | Full connection string | - | No (alternative) |
DATABASE_SCHEMA | Database schema | public | No |
DATABASE_SSL | Enable SSL | false | No |
DATABASE_POOL_MIN | Min pool connections | 2 | No |
DATABASE_POOL_MAX | Max pool connections | 10 | No |
Generate secure secrets using:
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
version: '3.8'
services:
strapi:
image: kubekanvas/strapi:latest
container_name: strapi
restart: unless-stopped
environment:
NODE_ENV: production
ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
API_TOKEN_SALT: ${API_TOKEN_SALT}
APP_KEYS: ${APP_KEYS}
TRANSFER_TOKEN_SALT: ${TRANSFER_TOKEN_SALT}
JWT_SECRET: ${JWT_SECRET}
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
ports:
- "1337:1337"
volumes:
- strapi-data:/opt/app/.tmp
- strapi-uploads:/opt/app/public/uploads
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:1337/_health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
interval: 30s
timeout: 3s
retries: 3
start_period: 40s
volumes:
strapi-data:
strapi-uploads:
After starting the container:
http://localhost:1337/adminThe image includes a built-in health check that monitors the application status:
docker inspect --format='{{.State.Health.Status}}' strapi
/opt/app/.tmp - Temporary files and SQLite database/opt/app/public/uploads - Uploaded media filesFor issues and questions:
If you want to deploy in Kubernetes please check complete instructions at following link
Note: Remember to change default secrets in production!
Content type
Image
Digest
sha256:d5d1d2345…
Size
336.7 MB
Last updated
9 months ago
docker pull kubekanvas/strapi