docs/docs/en/nocobase-cli/installation/docker-compose.md
If you want to run NocoBase directly on the server, docker compose is still the most direct way. One serving of docker-compose.yml is sufficient for most scenarios.
However, in a production environment, it is recommended to fix the specific version number and not use latest directly for a long time. This will make the upgrade more controllable.
13000mkdir my-nocobase-app
cd my-nocobase-app
docker-compose.ymlThe following example uses PostgreSQL, which is also the most worry-free combination by default:
networks:
nocobase:
driver: bridge
services:
app:
image: registry.cn-shanghai.aliyuncs.com/nocobase/nocobase:latest-full
restart: always
networks:
- nocobase
depends_on:
- postgres
environment:
- APP_KEY=replace-with-your-secret-key
- DB_DIALECT=postgres
- DB_HOST=postgres
- DB_PORT=5432
- DB_DATABASE=nocobase
- DB_USER=nocobase
- DB_PASSWORD=nocobase
- TZ=Asia/Shanghai
volumes:
- ./storage:/app/nocobase/storage
ports:
- '13000:80'
postgres:
image: registry.cn-shanghai.aliyuncs.com/nocobase/postgres:16
restart: always
command: postgres -c wal_level=logical
environment:
POSTGRES_USER: nocobase
POSTGRES_DB: nocobase
POSTGRES_PASSWORD: nocobase
volumes:
- ./storage/db/postgres:/var/lib/postgresql/data
networks:
- nocobase
in:
APP_KEY Remember to change it to your own random string13000:80 represents mapping the host's 13000 port to the container's 80 portpostgres section and change DB_HOST to the existing database addressIf you use MySQL or MariaDB, remember to change DB_DIALECT to the corresponding type and add:
DB_UNDERSCORED=true
docker compose up -d
Check the log:
docker compose logs -f app
After the application has started, open:
http://<服务器IP>:13000
If it is the first time to start, just follow the page prompts to initialize the administrator account.
Start or update containers:
docker compose up -d
Stop application:
docker compose down
Check the log:
docker compose logs -f app