Container or native
On this page
Every project deploys in one of two modes. Container mode builds a Docker image and runs it. Native mode builds a .tar.gz artifact and lays it out on your own server with systemd, nginx, and cron, the way you would by hand.
Which one to pick#
| Container | Native | |
|---|---|---|
| What gets built | A Docker image per commit | A .tar.gz artifact per commit |
| Where it runs | Dokwe Cloud or a BYOS server | A BYOS server only |
| Configuration | Auto-detected, or your Dockerfile | dokwe.yml in the repo (required) |
| Good for | Most web apps and APIs | Stacks with several host processes, such as Laravel with queues and Reverb, or Rails with Sidekiq |
You set the mode when you create the project, and you can change it later under Settings → Deployment mode.
Switching modes keeps existing deployments in history, but you can't roll back to them. They were built for the other format.
Container mode#
Container mode is the default and doesn't need a dokwe.yml. For each deployment, Dokwe picks a Dockerfile in this order:
- A custom Dockerfile saved in the project's Dockerfile tab.
- A
Dockerfilein the repository, or in the root directory if you set one. - A generated Dockerfile, based on the stack Dokwe detects.
Detection looks for these files at the build root:
| File | Detected as |
|---|---|
package.json | Next.js, Nuxt, NestJS, a static SPA (has a build script but no start), or Node.js |
requirements.txt or pyproject.toml | FastAPI, Django, Flask, or plain Python |
go.mod | Go |
Gemfile | Ruby |
| PHP project files | Laravel, Composer-based PHP, or plain PHP |
index.html | Static HTML |
If nothing matches and there's no Dockerfile, the build fails with a message listing these files.
For monorepos, set Root Directory in the project settings. You can also override the install, build, and start commands. These overrides apply only when Dokwe generates the Dockerfile.
Native mode#
Native mode deploys to a BYOS server running the Dokwe agent. A deployment runs in phases you can follow in the build log:
- Clone the repository.
- Read and validate
dokwe.yml(or the manifest path you set in settings). The manifest must saymode: native. - Check the runtime on the host. By default the agent installs missing pieces (Ubuntu and Debian). The build log shows the install as it runs: every line apt prints (agent 0.5.2 or later), and a "still installing" line each minute. A first install of several packages can take 10 to 20 minutes. If another install is running on the server (automatic security updates, for example), the agent waits for it, and if an earlier install was cut off part-way it finishes that first (
dpkg --configure -a). Agents older than 0.5.2 stop instead, and the deploy error says what to run. - Run your
buildcommands in a clean Docker sandbox on the Dokwe control plane. The resulting working tree becomes the artifact. - Package the artifact.
- Send it to the agent on your server.
- Release it on the host.
If Dokwe itself restarts during a native deploy (for example while it's being updated), the deploy stops and is marked failed with "Dokwe restarted while this deploy was running". Deploy again: anything the agent already installed is found by the runtime check, so the next deploy skips it.
Ports and domains#
Dokwe's proxy reaches your nginx on a port Dokwe assigns to each environment (40000–49999), and sends it only the domains that belong to that environment: its own Dokwe address, plus the project's custom domains when it's the main environment (production once it's live). A staging deploy never takes production's domains.
On each deploy Dokwe checks the stored port. If it's outside that range (left over from container mode, say), one your dokwe.yml uses for an app, or another environment's, the environment gets a new port and the routes follow. After the deploy goes live, Dokwe rewrites the custom-domain routes and the log says where each domain lands.
Releases and the symlink swap#
Under deploy.destination, the agent keeps a Capistrano-style layout:
/var/www/my-app/
├── current -> releases/<sha>
├── releases/
│ └── <sha>/
└── shared/Each deployment is unpacked into releases/<sha>/. Paths listed in deploy.shared are symlinked from shared/, so they survive across releases. Your release commands then run inside the new release directory, with your project's variables in their environment (the same ones the service gets from shared/.env), so a migration can read DATABASE_URL directly. release_rollback commands get them too. If any command exits non-zero, the deploy stops and the previous release stays active. When they succeed, current is switched to the new release and services are reloaded. Older releases beyond keepReleases (default 5, maximum 50) are pruned.
Environment variables are written to shared/.env by default (change it with env.file).
Service kinds#
Declare host processes under services. Each entry has a kind:
| Kind | Use it for | Required keys |
|---|---|---|
nginx+php-fpm | PHP apps. Document root defaults to public. | kind |
nginx-static | Static sites, SPAs, or an nginx front for a proxied app | kind |
systemd | Long-running processes such as workers, queues, and Node servers | kind, command |
cron | Scheduled commands, using a 5-field cron expression | kind, schedule, command |
If an nginx service has no domain, Dokwe routes your project's auto-domain (https://<slug>-app.dokwe.com) and any custom domains to it. If you set domain, nginx serves it directly and certbot handles TLS on the host.
Example dokwe.yml#
Run dokwe init to generate a starting manifest from your code, and dokwe validate to check it locally without a network call. Here is a Laravel example:
mode: native
host: web-1
runtime:
php: "8.3"
composer: "2.x"
extensions:
- mbstring
- pdo_mysql
- redis
build:
- composer install --no-dev --optimize-autoloader --no-interaction
- npm ci --no-audit --no-fund
- npm run build
deploy:
destination: /var/www/my-app
keepReleases: 5
owner:
user: www-data
group: www-data
shared:
- .env
- storage
release:
- php artisan migrate --force
- php artisan config:cache
- php artisan route:cache
release_rollback:
- php artisan migrate:rollback --force
services:
web:
kind: nginx+php-fpm
root: public
clientMaxBodySize: 64M
healthCheck:
type: http
path: /
expectStatus: [200, 301, 302]
queue:
kind: systemd
command: php artisan queue:work --sleep=3 --tries=3
restart: always
restartSec: 5
scheduler:
kind: cron
schedule: "* * * * *"
command: php artisan schedule:run
env:
file: .env
required:
- APP_KEY
- DB_PASSWORDhost is the slug of your BYOS server. Keys in env.required must be set in your project variables, or the deploy fails before anything is released. Never put secrets in env.defaults.
release_rollback runs when you roll back. Pair each release step that changes state, such as a migration, with a step that undoes it. See Rollbacks.
For every key, see the dokwe.yml reference.