Idle Sleep
Automatically sleep idle containers and wake them on traffic. Saves resources for infrequently used services
Overview
GoDoxy puts containers to sleep after a period of inactivity and wakes them automatically when traffic arrives. This feature is ideal for development environments, staging servers, or services with unpredictable usage patterns.
Supported Platforms
- Docker
- Podman through its Docker-compatible API
- Proxmox LXCs
Supported Protocols
| Protocol | Description |
|---|---|
| HTTP | Standard web traffic |
| TCP | Generic TCP connections |
| UDP | Generic UDP connections |
Quick Reference
| Property | Description | Default | Required |
|---|---|---|---|
idle_timeout | Inactivity before sleep | Disabled | Yes |
wake_timeout | Wait time for wake | 3m | No |
stop_method | Container stop method | stop | No |
stop_timeout | Stop command timeout | 1m | No |
stop_signal | Signal for stop/kill | Docker default | No |
start_endpoint | Wake trigger endpoint | Any | No |
no_loading_page | Disable wake page | false | No |
How It Works
Sleep Behavior
- Container receives no traffic for
idle_timeoutduration - GoDoxy executes
stop_methodon the container - Container dependencies are stopped in order unless another running watcher directly depends on them
- Traffic to the route triggers wake-up sequence
Wake Behavior
- Request arrives for sleeping route
- For an HTML navigation, GoDoxy returns the loading page immediately and starts one background wake operation
- Dependencies start first (if configured)
- Main container starts
- The loading page receives startup progress over server-sent events
- GoDoxy waits up to
wake_timeoutfor readiness, then the loading page refreshes into the active service
Non-HTML requests, and all requests when no_loading_page is enabled, wait for wake-up so GoDoxy can proxy the original request after the service becomes ready. Canceling an HTML navigation after its loading page has been returned does not cancel the shared wake operation.
Idle start, ready, sleep, pause, and error transitions appear in the WebUI Live Activity feed.
Dependency Management
Containers with depends_on wake their dependencies first, including transitive
dependencies. When a container sleeps, its dependencies also sleep unless
another running watcher directly depends on them. Shared dependencies remain
available until their last running dependent sleeps. Sleeping dependents do not
keep dependencies running; traffic wakes the required dependency chain again.
Podman Compose dependencies are discovered automatically through the native
Podman inspect API, including dependencies of services without their own idle
timeout. This works through a direct provider connection or an agent. When using
GoDoxy's socket proxy, enable CONTAINERS and use a version that allows native
Podman GET inspect requests.
proxy.depends_on overrides automatic discovery. Podman's native API does not
retain Compose readiness conditions, so automatically discovered dependencies
use service_started. For health-based readiness, set an explicit label such as
proxy.depends_on: redis:service_healthy. If native inspection fails, GoDoxy logs
a warning and keeps the routes; restore API access and reload to discover the
dependencies.
Do not set idle_timeout on dependency containers.
Condition Types
Control when dependencies are considered ready:
| Condition | Description |
|---|---|
service_started | Dependency process started |
service_healthy | Dependency healthcheck passes |
Docker Compose Example
# Without conditions (implies service_started)
depends_on:
- redis
- postgres
# With explicit conditions
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_startedLabel Syntax
labels:
proxy.depends_on: redis:service_healthy,postgres:service_startedDocker Configuration
Enable idle sleep by adding labels to your container:
services:
app:
image: nginx:latest
container_name: my-app
labels:
# Required
proxy.idle_timeout: 1h30s
# Optional
proxy.wake_timeout: 30s
proxy.stop_method: stop
proxy.stop_timeout: 10s
proxy.stop_signal: SIGINT
proxy.start_endpoint: /start
proxy.no_loading_page: true
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
redis:
image: redis:alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
postgres:
image: postgres:16
# Healthcheck configured via GoDoxy health monitoringProxmox LXC Configuration
See Proxmox Integration for detailed configuration options.
Sleep and Wake Notifications
Notifications are off by default. Configure providers under
providers.notification, then opt an idle-sleep route in using
idlewatcher.notify:
# Add inside the route's existing idlewatcher configuration
notify:
to: [gotify, ntfy] # Names under providers.notificationOmitting the notify block inherits the global notification configuration, or
stays silent when none is configured. notify: {} opts in and inherits global
targets when to is omitted. If global targets are also omitted, notifications
go to all current providers at send time.
To enable notifications for all routes that use idle sleep, add this to
config.yml:
defaults:
idlewatcher:
notify:
to: [gotify] # Use notify: {} to broadcast insteadUse notify: {} instead of the target list to send to all current providers.
A route can select different providers with to or opt out with
notify: {to: []}, overriding global targets. Global notify: {to: []} also
disables notifications, but a route can override it with a non-empty target
list. Global notification defaults do not enable idle sleep.
For Docker, use proxy.idle_notify_to: gotify,ntfy to select providers. A missing
label inherits the global notification configuration. To broadcast, configure
global notify: {}. proxy.idle_timeout is still required. An explicit empty
string opts a container out, even when global notifications are configured:
labels:
proxy.idle_timeout: 30m
proxy.idle_notify_to: ""These info-level notifications report sleep and wake transitions, with pause wording for paused containers. They do not report readiness or errors, and dependency-only containers do not send them. Initial observation, configuration reload, and watcher teardown do not send notifications.
Property Reference
Core Properties
| Property | Description | Default | Accepted Values |
|---|---|---|---|
idle_timeout | Inactivity before sleep | Disabled | Duration (1h30s, 15m) |
wake_timeout | Wait for wake completion | 3m | Duration |
start_endpoint | Wake trigger path | Any | Relative URI |
Stop Control
| Property | Description | Default | Accepted Values |
|---|---|---|---|
stop_method | Container stop action | stop | stop, pause, kill |
stop_timeout | Stop command wait time | 1m | Duration |
stop_signal | Signal for stop/kill | Docker default | SIGINT, SIGTERM, SIGQUIT, SIGKILL (with or without SIG prefix) |
With stop_method: kill, GoDoxy waits up to stop_timeout for the runtime to
confirm that the container stopped or paused before stopping its dependencies.
A signal such as SIGHUP may leave the container running. In that case, the
operation times out and its dependencies remain running.
UI Options
| Property | Description | Default | Values |
|---|---|---|---|
no_loading_page | Disable wake loading page | false | boolean |
Duration Format
Use standard duration notation:
| Unit | Description | Example |
|---|---|---|
s | Seconds | 30s |
m | Minutes | 15m |
h | Hours | 1h |
h m s | Combined | 1h30m15s |
Examples
Development Environment
services:
dev-api:
image: myapp/api:latest
labels:
proxy.idle_timeout: 30m
proxy.wake_timeout: 60s
proxy.stop_method: kill
proxy.stop_timeout: 5s
depends_on:
dev-db:
condition: service_healthy
dev-db:
image: postgres:16
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3sStaging with Specific Wake Endpoint
services:
staging-app:
image: myapp/staging:latest
labels:
proxy.idle_timeout: 2h
proxy.start_endpoint: /api/wake
proxy.no_loading_page: falseBest Practices
- Use healthchecks with
service_healthycondition for reliable dependencies - Set appropriate timeouts based on your service startup time
- Test wake behavior before deploying to production
- Monitor container logs during initial setup
- Use consistent stop signals that match your application