Skip to main content
Dokploy provides comprehensive Docker container management capabilities, allowing you to view, monitor, and control containers across local and remote servers.

Container Operations

Listing Containers

Dokploy can retrieve containers from both local Docker instances and remote servers:
// Get all containers on the local server
const containers = await getContainers();
The system automatically validates server access permissions and ensures only authorized users can view containers on remote servers.

Container Restart

Restart containers with a single API call:
await containerRestart(containerId);
Container IDs must match the regex pattern: ^[a-zA-Z0-9.\-_]+$

Container Configuration

Inspect detailed container configurations including:
  • Network settings
  • Volume mounts
  • Environment variables
  • Resource limits
  • Port mappings
const config = await getConfig(containerId, serverId);

Application Container Queries

By Application Name

Dokploy supports querying containers by application name with support for different deployment types:
1

Query by App Name Match

Retrieve containers matching a specific application name pattern:
const containers = await getContainersByAppNameMatch(
  appName,
  appType, // 'stack' or 'docker-compose'
  serverId
);
2

Query by App Label

Find containers using Dokploy-specific labels for both standalone and swarm deployments:
const containers = await getContainersByAppLabel(
  appName,
  type, // 'standalone' or 'swarm'
  serverId
);
3

Query Stack Containers

Get all containers belonging to a Docker stack:
const containers = await getStackContainersByAppName(appName, serverId);
4

Query Service Containers

Retrieve containers for Docker Swarm services:
const containers = await getServiceContainersByAppName(appName, serverId);

Container Types Support

Dokploy automatically detects and manages different container deployment types:

Standalone

Individual Docker containers running independently

Docker Compose

Multi-container applications defined in compose files

Docker Swarm

Clustered service deployments across multiple nodes

Security & Permissions

All container operations enforce strict security controls:
When accessing remote server containers, Dokploy validates that:
  • The server belongs to your active organization
  • You have proper authentication credentials
  • The serverId is valid and accessible

Authorization Flow

  1. User requests container operation
  2. System validates serverId (if provided)
  3. Server organization is checked against user’s active organization
  4. SSH key authentication is verified
  5. Operation is executed via Docker API

Container Monitoring

Dokploy provides real-time container metrics through its monitoring service:
  • CPU Usage - Percentage and core allocation
  • Memory - Usage, limits, and available memory
  • Network I/O - Incoming and outgoing traffic
  • Block I/O - Disk read/write operations
Container metrics are collected at configurable intervals (default: 60 seconds) and stored in a local SQLite database.

Metrics Collection

The monitoring service uses Docker stats API to collect:
{
  "timestamp": "2025-01-19T22:16:30.796129Z",
  "CPU": 83.76,
  "Memory": {
    "percentage": 0.03,
    "used": 2.262,
    "total": 7.654,
    "usedUnit": "MB",
    "totalUnit": "GB"
  },
  "Network": {
    "input": 306,
    "output": 0,
    "inputUnit": "B",
    "outputUnit": "B"
  },
  "BlockIO": {
    "read": 28.7,
    "write": 0,
    "readUnit": "kB",
    "writeUnit": "B"
  },
  "Container": "7428f5a49039",
  "Name": "my-app-container"
}

Remote Docker Connection

Dokploy connects to remote Docker daemons using SSH:
const dockerode = new Dockerode({
  host: server.ipAddress,
  port: server.port,
  username: server.username,
  protocol: 'ssh',
  sshOptions: {
    privateKey: server.sshKey?.privateKey
  }
});
If no serverId is provided, operations default to the local Docker instance.

Best Practices

Use consistent naming patterns that include:
  • Application name
  • Environment (dev/staging/prod)
  • Version or deployment ID
Example: myapp-prod-v1-abc123
Always set resource limits for containers:
  • Memory limits prevent OOM issues
  • CPU shares ensure fair resource allocation
  • Disk quotas prevent storage exhaustion
Configure monitoring to track specific services:
  • Include critical application containers
  • Exclude development/temporary containers
  • Set appropriate refresh rates based on needs
When managing multiple servers:
  • Use consistent SSH key management
  • Implement proper network segmentation
  • Monitor cross-server dependencies

Troubleshooting

Container Not Found

If a container cannot be found:
  • Verify the container ID or name is correct
  • Check if the container exists on the specified server
  • Ensure you have permissions to access the server

Connection Issues

For remote server connection problems:
  • Verify SSH credentials are valid
  • Check network connectivity to the server
  • Ensure Docker daemon is running on the remote host
  • Confirm firewall rules allow SSH connections

Monitoring Data Missing

If container metrics are not appearing:
  • Check that the container is included in monitoring configuration
  • Verify the monitoring service is running
  • Ensure the container is running (stopped containers don’t generate metrics)
  • Review monitoring service logs for errors

Build docs developers (and LLMs) love