| name | redis |
| description | Redis CLI client for cache and data store operations running inside a Docker container |
| runtime | docker |
Redis Skill
Access Redis databases using the redis-cli client running inside a Docker container. Set/get keys, manage data structures, monitor performance, and perform cache operations without installing Redis locally.
Overview
This skill provides the redis-cli command-line client through a containerized runtime. Connect to any Redis instance (local or remote), execute commands, manipulate data structures, and manage your cache - all while keeping your host system clean.
When to Use This Skill
Use this skill when you need to:
- Connect to Redis instances without local installation
- Set and get cached values
- Manage Redis data structures (strings, lists, sets, hashes, sorted sets)
- Monitor Redis performance and commands
- Test cache connections
- Debug caching issues
- Flush databases and manage keys
- Pub/Sub messaging operations
- Execute administrative commands
Prerequisites
Docker
The Redis client runs inside a Docker container:
brew install --cask docker
sudo apt-get update
sudo apt-get install docker.io
sudo systemctl start docker
Redis Server
You need access to a Redis server:
- Local Redis instance
- Remote Redis server
- Cloud-hosted Redis (AWS ElastiCache, Redis Cloud, Azure Cache, etc.)
- Docker Redis container
Configuration
Add to your .skill-engine.toml:
[skills.redis]
source = "docker:redis:7-alpine"
runtime = "docker"
description = "Redis CLI client"
[skills.redis.docker]
image = "redis:7-alpine"
entrypoint = "redis-cli"
network = "bridge"
memory = "128m"
rm = true
Configuration Explained
- image:
redis:7-alpine - Redis 7.x Alpine image (~30MB)
- entrypoint:
redis-cli - Redis command-line interface
- network:
bridge - Allows connections to Redis servers (local and remote)
- memory:
128m - Limits container to 128MB RAM
- rm:
true - Automatically removes container after execution
Usage
Redis skill uses pass-through syntax - all arguments after -- are passed directly to redis-cli:
skill run redis -- [redis-cli arguments] [COMMAND] [args...]
Connection Methods
Using Command-Line Arguments
skill run redis -- -h localhost
skill run redis -- -h localhost -p 6379
skill run redis -- -h redis.example.com -p 6379
skill run redis -- -h localhost -a password
skill run redis -- -h localhost -n 1
Using Environment Variables
export REDISCLI_AUTH=your_password
skill run redis -- -h localhost
Common Operations
String Operations
skill run redis -- -h localhost SET mykey "myvalue"
skill run redis -- -h localhost GET mykey
skill run redis -- -h localhost SET session:123 "data" EX 3600
skill run redis -- -h localhost MSET key1 "value1" key2 "value2"
skill run redis -- -h localhost MGET key1 key2
skill run redis -- -h localhost INCR counter
skill run redis -- -h localhost DECR counter
skill run redis -- -h localhost APPEND mykey " more data"
skill run redis -- -h localhost STRLEN mykey
Key Management
skill run redis -- -h localhost KEYS "*"
skill run redis -- -h localhost KEYS "user:*"
skill run redis -- -h localhost EXISTS mykey
skill run redis -- -h localhost DEL mykey
skill run redis -- -h localhost DEL key1 key2 key3
skill run redis -- -h localhost RENAME oldkey newkey
skill run redis -- -h localhost TYPE mykey
skill run redis -- -h localhost EXPIRE mykey 60
skill run redis -- -h localhost PEXPIRE mykey 60000
skill run redis -- -h localhost PERSIST mykey
skill run redis -- -h localhost TTL mykey
skill run redis -- -h localhost PTTL mykey
Hash Operations
skill run redis -- -h localhost HSET user:1 name "John"
skill run redis -- -h localhost HMSET user:1 name "John" email "john@example.com" age 30
skill run redis -- -h localhost HGET user:1 name
skill run redis -- -h localhost HMGET user:1 name email
skill run redis -- -h localhost HGETALL user:1
skill run redis -- -h localhost HKEYS user:1
skill run redis -- -h localhost HVALS user:1
skill run redis -- -h localhost HEXISTS user:1 name
skill run redis -- -h localhost HDEL user:1 age
skill run redis -- -h localhost HINCRBY user:1 visits 1
List Operations
skill run redis -- -h localhost LPUSH mylist "item1"
skill run redis -- -h localhost RPUSH mylist "item2"
skill run redis -- -h localhost RPUSH mylist "item3" "item4" "item5"
skill run redis -- -h localhost LLEN mylist
skill run redis -- -h localhost LRANGE mylist 0 -1
skill run redis -- -h localhost LRANGE mylist 0 9
skill run redis -- -h localhost LRANGE mylist 5 10
skill run redis -- -h localhost LPOP mylist
skill run redis -- -h localhost RPOP mylist
skill run redis -- -h localhost LINDEX mylist 0
skill run redis -- -h localhost LSET mylist 0 "new value"
skill run redis -- -h localhost LTRIM mylist 0 99
Set Operations
skill run redis -- -h localhost SADD myset "member1"
skill run redis -- -h localhost SADD myset "member2" "member3"
skill run redis -- -h localhost SMEMBERS myset
skill run redis -- -h localhost SISMEMBER myset "member1"
skill run redis -- -h localhost SCARD myset
skill run redis -- -h localhost SREM myset "member1"
skill run redis -- -h localhost SPOP myset
skill run redis -- -h localhost SRANDMEMBER myset
skill run redis -- -h localhost SINTER set1 set2
skill run redis -- -h localhost SUNION set1 set2
skill run redis -- -h localhost SDIFF set1 set2
Sorted Set Operations
skill run redis -- -h localhost ZADD leaderboard 100 "player1"
skill run redis -- -h localhost ZADD leaderboard 85 "player2" 92 "player3"
skill run redis -- -h localhost ZRANGE leaderboard 0 -1
skill run redis -- -h localhost ZRANGE leaderboard 0 -1 WITHSCORES
skill run redis -- -h localhost ZREVRANGE leaderboard 0 -1 WITHSCORES
skill run redis -- -h localhost ZRANGEBYSCORE leaderboard 80 100
skill run redis -- -h localhost ZSCORE leaderboard "player1"
skill run redis -- -h localhost ZRANK leaderboard "player1"
skill run redis -- -h localhost ZINCRBY leaderboard 5 "player1"
skill run redis -- -h localhost ZCARD leaderboard
skill run redis -- -h localhost ZREM leaderboard "player1"
skill run redis -- -h localhost ZREMRANGEBYRANK leaderboard 0 2
skill run redis -- -h localhost ZREMRANGEBYSCORE leaderboard 0 50
Pub/Sub Operations
skill run redis -- -h localhost SUBSCRIBE mychannel
skill run redis -- -h localhost SUBSCRIBE channel1 channel2
skill run redis -- -h localhost PSUBSCRIBE "news:*"
skill run redis -- -h localhost PUBLISH mychannel "Hello World"
skill run redis -- -h localhost PUBSUB CHANNELS
skill run redis -- -h localhost PUBSUB NUMSUB mychannel
Database Management
Select Database
skill run redis -- -h localhost -n 0
skill run redis -- -h localhost -n 1
skill run redis -- -h localhost SELECT 2
Flush Operations
skill run redis -- -h localhost FLUSHDB
skill run redis -- -h localhost FLUSHALL
skill run redis -- -h localhost FLUSHDB ASYNC
Monitoring & Administration
Server Information
skill run redis -- -h localhost INFO
skill run redis -- -h localhost INFO server
skill run redis -- -h localhost INFO memory
skill run redis -- -h localhost INFO stats
skill run redis -- -h localhost INFO replication
skill run redis -- -h localhost INFO cpu
skill run redis -- -h localhost CONFIG GET "*"
skill run redis -- -h localhost CONFIG GET maxmemory
skill run redis -- -h localhost CONFIG SET maxmemory 100mb
Monitoring Commands
skill run redis -- -h localhost MONITOR
skill run redis -- -h localhost SLOWLOG GET 10
skill run redis -- -h localhost SLOWLOG RESET
skill run redis -- -h localhost CLIENT LIST
skill run redis -- -h localhost CLIENT GETNAME
skill run redis -- -h localhost CLIENT SETNAME myapp
skill run redis -- -h localhost CLIENT KILL addr 127.0.0.1:6379
Performance & Statistics
skill run redis -- -h localhost DBSIZE
skill run redis -- -h localhost LASTSAVE
skill run redis -- -h localhost --latency
skill run redis -- -h localhost --latency-history
skill run redis -- -h localhost --stat
skill run redis -- -h localhost PING
Advanced Examples
Cache Pattern
skill run redis -- -h localhost GET cache:user:123
skill run redis -- -h localhost SET cache:user:123 '{"name":"John"}' EX 300
skill run redis -- -h localhost DEL cache:user:123
skill run redis -- -h localhost EVAL "return redis.call('del', unpack(redis.call('keys', 'cache:*')))" 0
Session Management
skill run redis -- -h localhost SET session:abc123 '{"user_id":1,"email":"user@example.com"}' EX 3600
skill run redis -- -h localhost GET session:abc123
skill run redis -- -h localhost EXPIRE session:abc123 3600
skill run redis -- -h localhost DEL session:abc123
Rate Limiting
skill run redis -- -h localhost INCR rate:user:123:minute
skill run redis -- -h localhost EXPIRE rate:user:123:minute 60
skill run redis -- -h localhost GET rate:user:123:minute
Distributed Locks
skill run redis -- -h localhost SET lock:resource:1 "token123" NX EX 30
skill run redis -- -h localhost DEL lock:resource:1
skill run redis -- -h localhost GET lock:resource:1
Batch Operations
Execute Multiple Commands
cat << EOF | skill run redis -- -h localhost
SET key1 "value1"
SET key2 "value2"
GET key1
EOF
skill run redis -- -h localhost < commands.txt
Scan Keys
skill run redis -- -h localhost SCAN 0 MATCH "user:*" COUNT 100
skill run redis -- -h localhost SCAN 0
skill run redis -- -h localhost SCAN cursor MATCH "pattern*"
Security
Authentication
skill run redis -- -h localhost -a your_password
export REDISCLI_AUTH=your_password
skill run redis -- -h localhost
skill run redis -- -h localhost AUTH your_password
ACL (Redis 6+)
skill run redis -- -h localhost ACL LIST
skill run redis -- -h localhost ACL WHOAMI
skill run redis -- -h localhost ACL SETUSER alice on \>password ~cached:* +get
skill run redis -- -h localhost ACL DELUSER alice
Troubleshooting
Connection Issues
skill run redis -- -h localhost PING
docker ps | grep redis
telnet localhost 6379
Authentication Failed
export REDISCLI_AUTH=correct_password
skill run redis -- -h localhost PING
skill run redis -- -h localhost -a correct_password PING
Cannot Connect to Docker Network
skill run redis -- -h host.docker.internal
skill run redis -- -h 172.17.0.1
Performance Issues
skill run redis -- -h localhost SLOWLOG GET 10
skill run redis -- -h localhost INFO memory
skill run redis -- -h localhost CLIENT LIST
Common Errors
| Error | Cause | Solution |
|---|
| "Connection refused" | Redis not running or wrong port | Check server status and port |
| "NOAUTH Authentication required" | Password needed | Use -a password or set REDISCLI_AUTH |
| "WRONGPASS invalid password" | Incorrect password | Verify password |
| "MOVED" or "ASK" | Redis Cluster redirect | Connect to correct node |
| "OOM command not allowed" | Out of memory | Check maxmemory setting |
Redis CLI Options
Useful Flags
skill run redis -- -h localhost --raw GET mykey
skill run redis -- -h localhost --csv LRANGE mylist 0 -1
skill run redis -- -h localhost -c "SET key value"
skill run redis -- -h localhost --repeat 5 PING
skill run redis -- -h localhost --interval 1 --repeat 10 INFO stats
skill run redis -- -h localhost -c --cluster
skill run redis -- -h localhost --tls --cacert ca.crt
Docker Image Details
- Image:
redis:7-alpine
- Base: Alpine Linux
- Size: ~30MB
- Redis Version: 7.x
- Included Tools: redis-cli, redis-benchmark
- Platforms: linux/amd64, linux/arm64
Resources
Quick Reference
Essential Commands Table
| Operation | Command |
|---|
| Connect | -h host -p port |
| Authenticate | -a password |
| Set key | SET key value |
| Get key | GET key |
| Set with TTL | SET key value EX seconds |
| Delete key | DEL key |
| List keys | KEYS pattern |
| Check exists | EXISTS key |
| Set expiry | EXPIRE key seconds |
| Get TTL | TTL key |
| Hash set | HSET hash field value |
| Hash get | HGET hash field |
| List push | RPUSH list value |
| List range | LRANGE list 0 -1 |
| Set add | SADD set member |
| Sorted set add | ZADD zset score member |
| Publish | PUBLISH channel message |
| Subscribe | SUBSCRIBE channel |
| Server info | INFO |
| Monitor | MONITOR |
| Flush DB | FLUSHDB |
| Ping | PING |