Manage a shared Redis Docker container for local dev environments. Handles container lifecycle, key inspection, and selective data flush. Joins the shared Do...
---
name: Redis Manager
slug: redis-manager
version: 1.1.0
description: "Manage a shared Redis Docker container for local dev environments. Handles container lifecycle, key inspection, and selective data flush. Joins the shared Docker network created by proxy-manager."
changelog: "v1.1.0: Fix flush-db to use single redis-cli -n connection (was flushing wrong DB), validate DB number input, warn on default password, bind host port to 127.0.0.1, pin image to redis:7.4-alpine."
triggers:
- "start redis"
- "stop redis"
- "redis status"
- "flush redis"
- "limpar redis"
- "redis keys"
- "redis-manager"
metadata: {"clawdbot":{"emoji":"🔴","requires":{"bins":["docker"]},"os":["linux","darwin"]}}
---
# Redis Manager
Manages the shared Redis Docker container for local dev environments.
## Architecture
```
redis-manager/
├── docker-compose.yml # Redis 7 Alpine container
└── run.sh # lifecycle + data inspection CLI
```
Joins the shared `nginx-proxy_net` network (created by proxy-manager) so all app containers can connect via hostname `codai_redis`. Data is persisted in a named volume.
## Commands
```bash
./run.sh start # start Redis container
./run.sh stop # stop container (data persists in volume)
./run.sh status # status + key count + memory usage
./run.sh wait # block until Redis responds PONG
./run.sh flush # FLUSHALL — clear all data (interactive confirm)
./run.sh flush-db <n> # FLUSHDB on database N (interactive confirm)
./run.sh list-keys [<pattern>]# KEYS <pattern> (default: *)
./run.sh cli # open redis-cli interactive session
```
## How to Execute Tasks
### Start Redis
```bash
cd redis-manager && ./run.sh start
```
### Check status and memory usage
```bash
./run.sh status
```
### Inspect keys for a specific instance
```bash
./run.sh list-keys "session:*"
./run.sh list-keys "cache:feature*"
```
### Flush session data for testing
```bash
./run.sh flush-db 0 # flush default db only
```
## Startup Order
1. `proxy-manager start` — creates the shared Docker network
2. `mysql-manager start` (or `postgres-manager start`)
3. `redis-manager start`
## Configuration
| Variable | Default | Purpose |
|-------------------|---------------|----------------------------------|
| `REDIS_CONTAINER` | `codai_redis` | Container name |
| `REDIS_PASSWORD` | `redispass` | Redis AUTH password |
| `REDIS_PORT` | `6380` | Host port (maps to 6379) |
| `REDIS_MAXMEMORY` | `256mb` | Max memory before eviction |
| `CODAI_NETWORK` | `nginx-proxy_net` | Shared Docker network name |
## App Connection
Backend containers connect to Redis at:
- **Host**: `codai_redis` (container name on shared network)
- **Port**: `6379`
- **Password**: `redispass` (or `REDIS_PASSWORD`)
## Rules
- `flush` always prompts for confirmation — it deletes all data in all databases.
- `flush-db <n>` flushes exactly database N using a single `-n` connection; confirm text always matches the database being flushed.
- `stop` preserves data in the Docker volume. Use `docker compose down -v` only when you intentionally want to delete persisted data.
- The container uses `restart: unless-stopped` — it will resume after a Docker daemon restart. Run `./run.sh stop` when done.
- The host port (`REDIS_PORT`) is bound to `127.0.0.1` only. Set a non-default `REDIS_PASSWORD` on shared machines.
- Redis connects to the `nginx-proxy_net` network as `external: true` — proxy-manager must start first.
## Related Plugins
- `proxy-manager` — creates the shared Docker network (start first)
- `mysql-manager` — relational DB companion
- `postgres-manager` — relational DB companion
- `worktree-manager` — app instances that consume Redis
don't have the plugin yet? install it then click "run inline in claude" again.
added explicit input dependencies (docker, proxy-manager, env vars), expanded 10-step procedure with input/output per step, documented 9 decision points covering network setup, password warnings, validation, timeouts, and failure modes, and specified output contract format plus outcome signals for each command.
manages the shared Redis Docker container for local dev environments. run this to start/stop Redis, check memory and key counts, inspect data by pattern, or selectively flush databases without losing everything. use it during dev setup before spinning up app instances, or when you need to wipe test data mid-session. Redis lives on the shared Docker network created by proxy-manager, so all app containers can hit it via hostname codai_redis on port 6379.
proxy-manager start first to create the nginx-proxy_net Docker network. redis-manager assumes this network exists as external.codai_redis).redispass). change this on shared machines; default is insecure.6380). maps to container's 6379. bound to 127.0.0.1 only.256mb).nginx-proxy_net).ensure proxy-manager has run proxy-manager start. verify the nginx-proxy_net network exists: docker network ls | grep nginx-proxy_net.
(optional) set env vars if you want non-default values:
export REDIS_CONTAINER=my_redis
export REDIS_PASSWORD=strongpass123
export REDIS_PORT=6381
export REDIS_MAXMEMORY=512mb
start the container:
cd redis-manager
./run.sh start
output: container starts, joins network, persists data in named volume. confirm with docker ps | grep codai_redis.
(optional) wait for Redis to be ready:
./run.sh wait
output: blocks until Redis replies PONG. exits 0 on success, non-zero on timeout (default 30s).
check status, key count, and memory:
./run.sh status
output: prints container status (running/stopped), total key count, memory used, memory peak, eviction policy.
inspect keys by pattern (optional):
./run.sh list-keys
./run.sh list-keys "session:*"
./run.sh list-keys "cache:feature*"
output: key list matching pattern (default: all keys via *). includes key count. warns if >1000 keys returned.
open interactive redis-cli (optional):
./run.sh cli
output: interactive redis-cli prompt. already authenticated. type exit to return.
flush a single database (interactive):
./run.sh flush-db 0
output: prompts "flush database 0? (yes/no)". only flushes database 0 if yes. uses single -n 0 redis-cli connection.
flush all databases (interactive):
./run.sh flush
output: prompts "FLUSHALL will delete all data in all databases. confirm? (yes/no)". only runs FLUSHALL if yes.
stop the container when done:
./run.sh stop
output: container stops. data persists in volume. container will auto-restart on Docker daemon restart due to restart: unless-stopped policy. if you want to delete persisted data, run docker compose down -v instead.
redis-manager start will fail with network not found error. always start proxy-manager first.status and list-keys output. set a strong password via env var before sharing the machine../run.sh flush or ./run.sh flush-db <n> is called: script prompts for interactive confirmation. user types "yes" (exact match, case-insensitive allowed per implementation) to proceed. no confirmation = no flush../run.sh flush-db <n> receives invalid DB number (non-integer, <0, >15): script rejects with error. Redis supports 16 databases (0-15) by default../run.sh list-keys <pattern> returns >1000 keys: script warns that output is truncated and suggests a more specific pattern../run.sh list-keys or ./run.sh flush-db: redis-cli fails to connect. script errors with "connection refused". user must run ./run.sh start first../run.sh wait can retry.docker compose up fails with bind error. user must change REDIS_PORT or kill the process using that port.docker volume rm and recreate.docker ps | grep codai_redis and see the container running. run ./run.sh status and see key count and memory. run ./run.sh wait and get PONG back../run.sh list-keys and see fewer keys (or zero if database was previously populated).docker ps | grep codai_redis and see the container no longer running. run ./run.sh start again and confirm data is still there../run.sh start), network does not exist (run proxy-manager start), or Docker daemon is down.