Skip to main content

Container Configuration

Fine-tune your container with environment variables, resource limits, and advanced settings.

Container Configuration

Environment Variables​

Environment variables are the primary way to configure your containers.

Adding Variables​

  1. Go to your container
  2. Click the Configuration tab
  3. Under Environment Variables, click Add Variable
  4. Enter the key and value
  5. Click Save

Changes are saved immediately, but running instances keep their current configuration. A Restart required banner appears at the top of the page — click Restart on the container to apply the new configuration. Starting a stopped container or saving its deployment settings (image, resources…) also applies it.

Variable Types​

TypeUse CaseExample
PlainNon-sensitive configNODE_ENV=production
SecretSensitive dataAPI_KEY=sk-xxxxx
Secrets

Toggle the "Secret" option to mask values in the UI. Secret values are encrypted at rest and never exposed in logs.

Common Variables​

VariableDescription
PORTApplication listening port
NODE_ENVNode.js environment
DATABASE_URLDatabase connection string
REDIS_URLCache connection string
LOG_LEVELLogging verbosity

Referencing Other Resources​

Use internal DNS for database and cache connections. The format is {service-name}.{namespace}:

# PostgreSQL (service-name.namespace)
DATABASE_URL=postgresql://user:[email protected]:5432/dbname

# Valkey/Redis (service-name.namespace)
REDIS_URL=redis://my-cache.my-project-abc123:6379

The namespace is automatically assigned to your project. You can find it in your project settings or resource details.

Injected Variables​

The Configuration tab shows a read-only Injected Variables section when your container or job has active service connections or managed observability enabled. These variables are managed by SailOps and cannot be edited manually — they update automatically when you add, modify, or remove a connection.

Mounted Files​

Mount configuration files directly into your container's filesystem.

Adding a Mounted File​

  1. Go to your container
  2. Click the Configuration tab
  3. Under Mounted Files, click Add File
  4. Configure the file:
    • Name: Identifier for the file (e.g., config-json, htpasswd)
    • Path: Mount path inside the container (e.g., /app/config.json)
    • Type: config (plain) or secret (encrypted at rest)
    • Content: File contents
  5. Click Save

Editing a mounted file​

The files table shows the content of config files directly and masks secret file content.

When you edit an existing secret file, the Name and Type fields are locked because the stored content is keyed by name. To change the path, edit the file and update only the Path field — leave the content field empty to keep the current content. To replace the content, type the new value in the content field. If you need to rename a secret file, delete it and mount a new one.

File name rules​

ConstraintRule
Allowed charactersLowercase letters, digits, and -
Start / endMust start and end with a letter or digit
Maximum length56 characters
UniquenessMust be unique within the container
Pattern^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ (RFC 1123 label)
warning

The file name is used to build the Kubernetes volume name (config- or secret- prefix + file name). Names that do not follow these rules are rejected before the deployment is submitted.

Container Isolation​

All containers on SailOps benefit from strong isolation by default. Each container runs in a fully isolated environment, protecting it from other containers and the host system.

This isolation is automatic and requires no configuration. It also means containers can safely run as root if needed.

Resource Configuration​

Compute Class​

Change compute resources anytime:

  1. Go to your container
  2. Click Edit
  3. Select a new compute class
  4. Click Save

Changes apply with zero downtime via rolling update.

Resource Limits​

SailOps automatically sets resource limits based on your compute class. Each class has a fixed CPU:RAM ratio, and you configure resources using sliders within the class limits.

ClassCPU:RAM RatioMax CPUMax RAM
Eco1:23 cores6 GB
Standard1:415 cores58 GB
Spot1:415 cores58 GB
Production1:46 cores28 GB
Prod. Compute1:26 cores16 GB
Prod. Memory1:86 cores58 GB
ARM1:48 cores32 GB

Example resources for Standard class (1:4 ratio):

CPUMemory
1 vCPU4 GB
2 vCPU8 GB
4 vCPU16 GB
8 vCPU32 GB
Memory Limits

If your application exceeds the memory limit, it will be killed (OOMKilled). Monitor memory usage and upgrade if needed.

Compute Class Maxima

Each compute class enforces maximum CPU and RAM values. Requests that exceed the class maximum are rejected with a validation error. To use more resources, switch to a class with higher limits.

Spot Class

The Spot class offers the same resource limits as Standard but at a reduced cost with no SLA guarantees. Workloads may be interrupted when resources are needed by higher-priority workloads.

GPU Compute Classes​

GPU compute classes are designed for AI/ML workloads, rendering, and other GPU-intensive tasks. Each GPU class enforces minimum CPU and RAM requirements to ensure optimal GPU performance.

ClassGPU ModelGPU ModeGPU MemoryDescription
gpu-l4NVIDIA L4Dedicated24 GBGeneral-purpose GPU for AI inference
gpu-h100-mig-smallNVIDIA H100MIG 1g.10gb10 GBH100 MIG slice for development/testing
gpu-h100-mig-mediumNVIDIA H100MIG 2g.20gb20 GBH100 MIG slice for small workloads
gpu-l40sNVIDIA L40SDedicated48 GBHigh-memory GPU for large models
gpu-h100NVIDIA H100Dedicated80 GBTop-tier GPU for training and inference
Plan Requirements

Some GPU classes require BUSINESS or CUSTOM support plans. Check your organization's plan before deploying GPU workloads.

GPU Metrics

When using GPU classes, additional metrics (GPU utilization and GPU memory usage) appear in the Metrics tab for monitoring your GPU workloads.

Persistent Volumes​

Attach durable storage to your container for data that must persist across restarts and redeployments (e.g., SQLite databases, file uploads, disk caches). Two storage classes are available: Standard (5K IOPS) for general workloads and Performance (15K IOPS) for I/O-intensive applications.

See the dedicated Persistent Volumes guide for full configuration details, storage classes, limitations, and best practices.

Port Configuration​

Exposed Ports​

Configure which ports your container exposes:

FieldDescription
PortInternal container port
ProtocolTCP (default) or UDP

Multiple Ports​

You can expose multiple ports from a single container:

PortProtocolPurpose
3000TCPAPI
3001TCPWebSocket
9090TCPMetrics

Each port can be routed via a Gateway.

Health Checks​

Configure health checks to ensure your container is healthy:

HTTP Health Check​

ParameterValue
TypeHTTP
Path/health
Port3000
Interval30s
Timeout5s
Success Threshold1
Failure Threshold3

TCP Health Check​

For non-HTTP services:

ParameterValue
TypeTCP
Port5432
Interval30s
Timeout5s

Best Practices​

  • Keep health check endpoints lightweight
  • Return 200 status for healthy, 5xx for unhealthy
  • Include dependency checks (database connectivity)
  • Don't perform heavy computations in health checks

Example health endpoint (Node.js):

app.get('/health', async (req, res) => {
try {
await db.query('SELECT 1');
res.status(200).json({ status: 'healthy' });
} catch (error) {
res.status(503).json({ status: 'unhealthy' });
}
});

Startup Configuration​

Container Command​

Override the default startup command in the Container Command field within Basic Configuration. Enter the complete command as you would type it in a terminal — the system handles parsing.

nginx -g 'daemon off;'
/bin/sh -c 'echo hello && sleep 5'
node server.js --port 3000

Leave empty to use the command defined in your container image.

Security Context (Optional)​

Security context settings are optional on SailOps. Thanks to strong container isolation, containers can safely run as root without additional configuration.

When to Configure Security Context​

Use CaseSecurity Context Needed?
Standard applicationsNo - isolation is sufficient
Legacy apps requiring rootNo - root is safe
Compliance requirementsYes - enables audit controls
Defense in depthYes - adds application-level restrictions

Available Settings​

When you set RunAsUser and/or RunAsGroup, the following restrictions are automatically applied:

SettingDescription
Run As User IDNumeric UID (e.g., 1000)
Run As Group IDNumeric GID (e.g., 1000)
Read-Only FilesystemEnabled automatically when UID/GID set
Non-Root EnforcementEnabled automatically when UID/GID set

Configuring Security Context​

  1. Go to your container
  2. Click Edit or access Advanced Settings
  3. Navigate to Security Context
  4. Enter User ID and/or Group ID
  5. Save changes
Leave Empty for Flexibility

If your application needs root access or you don't have compliance requirements, leave these fields empty. Container isolation is sufficient for security.

Labels and Annotations​

Add metadata to your containers:

LabelValue
appapi
environmentproduction
teambackend

Labels are useful for:

  • Filtering in the UI
  • Organization
  • Cost allocation

Restart Policy​

Containers automatically restart on failure:

PolicyBehavior
AlwaysAlways restart (default)
OnFailureRestart only on non-zero exit
NeverNever restart automatically

Configuration Examples​

Production API Server​

ParameterValue
Nameapi-prod
Imagemyapp/api:v1.2.3
Compute ClassStandard
CPU2 vCPU
Memory8 GB (auto-calculated from 1:4 ratio)
Replicas3

Environment variables:

VariableValue
NODE_ENVproduction
PORT3000
DATABASE_URLpostgresql://...
REDIS_URLredis://...
LOG_LEVELinfo

Health check: HTTP on /health:3000 every 15s

Labels: app=api, environment=production

Background Worker​

ParameterValue
Nameworker
Imagemyapp/worker:v1.2.3
Compute ClassEco
CPU1 vCPU
Memory2 GB (auto-calculated from 1:2 ratio)
Replicas2

Environment variables:

VariableValue
QUEUE_URLredis://...
CONCURRENCY5

Health check: TCP on port 9000

Scheduled Job​

ParameterValue
Namecron-job
Imagemyapp/cron:latest
Compute ClassEco
CPU0.5 vCPU
Memory1 GB (auto-calculated from 1:2 ratio)
Replicas1

Environment variables:

VariableValue
SCHEDULE0 * * * *

Best Practices​

Environment-Specific Config​

Use different values per environment:

# Development
DATABASE_URL=postgresql://localhost:5432/dev

# Production (using internal DNS: service-name.namespace)
DATABASE_URL=postgresql://prod-db.my-project-abc123:5432/prod

Twelve-Factor App​

Follow the twelve-factor methodology:

  1. Store config in environment variables
  2. Keep development and production as similar as possible
  3. Treat backing services as attached resources

Secret Management​

  • Never commit secrets to version control
  • Use environment variables for secrets
  • Rotate secrets regularly
  • Use different secrets per environment

Troubleshooting​

Configuration Not Applied​

  • Configuration changes are not applied automatically — you must restart the container manually
  • After saving, a Restart required banner confirms that the configuration was updated
  • Check the Events tab for update status
  • Verify the configuration was saved

OOMKilled​

  • Your container exceeded memory limits
  • Upgrade to a larger compute class
  • Optimize your application's memory usage

CrashLoopBackOff​

  • Container keeps crashing
  • Check Logs for error messages
  • Verify environment variables
  • Ensure health check is correct