Skip to main content
Redis is an open-source, in-memory data structure store used as a database, cache, message broker, and streaming engine. Dokploy makes it easy to deploy and manage Redis instances as Docker services.

Creating a Redis Database

To create a Redis database in Dokploy:
  1. Navigate to your project
  2. Select the environment
  3. Click “Add Service” and select “Redis”
  4. Configure the database settings

Basic Configuration

  • Name - A friendly name for your Redis instance
  • App Name - The Docker service name (used for internal DNS)
  • Description - Optional description
  • Docker Image - Default: redis:latest (recommended: redis:7-alpine or redis:7)

Database Credentials

  • Database Password - Password for Redis authentication (optional but recommended)
The password is automatically configured via the REDIS_PASSWORD environment variable and passed as a command argument: redis-server --requirepass [password]

Advanced Settings

  • External Port - Optional port to expose Redis externally (default internal port: 6379)
  • Command - Override the default container command
  • Args - Additional arguments to pass to Redis server
  • Environment Variables - Additional custom environment variables

Connection Strings

Internal Connection (from other services)

With Password

Example:

External Connection

If you’ve configured an external port (e.g., 6380):
Never expose Redis to the internet without a strong password. Redis is designed for trusted environments.

Connection String Formats

Environment Variables

Redis containers support these environment variables:
Dokploy automatically configures Redis with the password using the --requirepass argument.

Data Persistence

Redis data is stored in a Docker volume mounted at:
  • Mount Path: /data
  • Volume Name: {appName}-data
The volume persists even when the container is stopped or removed.

Persistence Modes

Redis supports two persistence modes:
  1. RDB (Redis Database) - Point-in-time snapshots
  2. AOF (Append Only File) - Logs every write operation
To enable AOF persistence, add to Args:

Resource Configuration

Configure resource limits for your Redis instance:
Redis is memory-intensive. Set maxmemory to prevent Redis from using all available memory and configure an eviction policy.

Operations

Starting the Database

Click the “Start” button in the Dokploy UI or use the API:

Stopping the Database

Click the “Stop” button or use the API:

Reloading the Database

Reload applies configuration changes by stopping and starting the service:

Rebuilding the Database

Rebuilding will delete all data. Make sure to backup first!

Accessing Redis CLI

To access the Redis CLI in the running container:
Or use the Dokploy terminal feature in the UI.

Common Redis Commands

Configuration Options

Add these as arguments in the “Args” field:

Eviction Policies

When Redis reaches max memory, it can evict keys based on different policies:
For caching use cases, allkeys-lru is usually the best policy.

Use Cases

1. Caching

2. Session Storage

3. Rate Limiting

4. Message Queue

5. Pub/Sub

Monitoring and Performance

Key Metrics to Monitor

Slow Query Log

Backups

While Redis is typically used for caching and doesn’t need backups, Dokploy supports Redis backups if persistence is enabled.

Manual Backup

See the Backups page for automated backup configuration.

Troubleshooting

Connection Refused

  • Verify the service is running in Dokploy UI
  • Check the service name matches your appName
  • Ensure your application is in the same Docker network

Authentication Failed

  • Verify password in the database settings
  • Check if password is correctly set in connection string
  • Use -a password flag with redis-cli

Out of Memory

  • Check current memory usage: INFO memory
  • Set maxmemory limit
  • Configure eviction policy
  • Increase memory limits in resource configuration

Performance Issues

  • Check slow query log: SLOWLOG GET
  • Monitor key sizes: Large keys can slow Redis
  • Use pipelining for multiple operations
  • Enable AOF if needed, but be aware of performance impact
  • Consider using Redis Cluster for large datasets

Best Practices

  1. Use Specific Versions - Pin to specific Redis versions (e.g., redis:7.2.4-alpine) instead of latest
  2. Always Use Passwords - Never run Redis without authentication in production
  3. Set Max Memory - Always configure maxmemory to prevent OOM issues
  4. Choose Eviction Policy - Select appropriate eviction policy for your use case
  5. Don’t Expose Publicly - Keep Redis on internal networks
  6. Monitor Memory - Watch memory usage and key counts
  7. Use Connection Pooling - Reuse connections in your applications
  8. Enable Persistence - Use AOF or RDB if data durability is important
  9. Avoid Large Keys - Keep individual keys small (< 1MB recommended)
  10. Use Key Expiration - Set TTL on keys to prevent unbounded growth

Redis vs Other Caches

Next Steps

Backups

Configure Redis persistence and backups

Overview

Learn about other database options