docker.recipes

Valkey

beginner

Open-source Redis fork maintained by Linux Foundation with full compatibility.

Overview

Valkey is a high-performance, open-source in-memory data structure store that serves as a drop-in replacement for Redis. Born from the Redis 7.2.4 codebase, Valkey was created when Redis changed to a restrictive license, prompting the Linux Foundation to fork the project and maintain it as truly open-source software. Backed by major cloud providers including AWS, Google Cloud, and Oracle, Valkey maintains full compatibility with Redis APIs, protocols, and data formats while ensuring continued open-source development. This deployment provides a single Valkey server instance configured with password authentication and persistent data storage. The container runs the latest Valkey server with data persistence through Docker volumes and exposes the standard Redis-compatible port 6379. All existing Redis clients, tools, and applications can connect to Valkey without modification, making migration straightforward for teams looking to move away from Redis's new licensing model. This configuration is ideal for developers, startups, and organizations seeking a reliable, community-driven alternative to Redis without vendor lock-in concerns. The setup provides enterprise-grade caching and data storage capabilities while maintaining the familiar Redis experience that millions of applications depend on.

Key Features

  • Full Redis API compatibility for seamless migration from existing Redis deployments
  • Password-protected access using VALKEY_PASSWORD environment variable for security
  • Persistent data storage with automatic recovery after container restarts
  • Linux Foundation governance ensuring long-term open-source commitment
  • Support for all Redis data types including strings, hashes, lists, sets, and streams
  • High-performance in-memory operations with optional disk persistence
  • Compatible with existing Redis monitoring tools and client libraries
  • Community-driven development with contributions from major cloud providers

Common Use Cases

  • 1Session storage for web applications requiring fast user state management
  • 2High-performance caching layer for database query results and computed data
  • 3Real-time analytics and metrics collection with fast read/write operations
  • 4Message queuing and pub/sub systems for event-driven architectures
  • 5Rate limiting and API throttling for web services and microservices
  • 6Leaderboards and gaming applications requiring sorted sets and atomic operations
  • 7Shopping cart storage for e-commerce platforms with temporary data needs

Prerequisites

  • Docker and Docker Compose installed with at least 512MB available RAM
  • Port 6379 available and not used by existing Redis or other services
  • Basic understanding of Redis commands and data structures
  • Redis CLI or compatible client tools for testing and administration
  • Environment variable VALKEY_PASSWORD defined in .env file or system
  • Sufficient disk space for persistent data storage based on expected dataset size

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 valkey:
3 image: valkey/valkey:latest
4 container_name: valkey
5 restart: unless-stopped
6 command: valkey-server --requirepass ${VALKEY_PASSWORD}
7 volumes:
8 - valkey_data:/data
9 ports:
10 - "6379:6379"
11 networks:
12 - valkey-network
13
14volumes:
15 valkey_data:
16
17networks:
18 valkey-network:
19 driver: bridge

.env Template

.env
1VALKEY_PASSWORD=changeme

Usage Notes

  1. 1Docs: https://valkey.io/docs/
  2. 2Redis-compatible on port 6379 - use any Redis client
  3. 3Linux Foundation project - truly open-source Redis fork
  4. 4Drop-in Redis replacement - same API and data formats
  5. 5Community-driven with contributions from AWS, Google, Oracle
  6. 6Test: redis-cli -a YOUR_PASSWORD ping

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 valkey:
5 image: valkey/valkey:latest
6 container_name: valkey
7 restart: unless-stopped
8 command: valkey-server --requirepass ${VALKEY_PASSWORD}
9 volumes:
10 - valkey_data:/data
11 ports:
12 - "6379:6379"
13 networks:
14 - valkey-network
15
16volumes:
17 valkey_data:
18
19networks:
20 valkey-network:
21 driver: bridge
22EOF
23
24# 2. Create the .env file
25cat > .env << 'EOF'
26VALKEY_PASSWORD=changeme
27EOF
28
29# 3. Start the services
30docker compose up -d
31
32# 4. View logs
33docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/valkey/run | bash

Troubleshooting

  • Connection refused on port 6379: Verify the valkey container is running with 'docker ps' and check port binding
  • Authentication failed error: Ensure VALKEY_PASSWORD environment variable is set and matches client configuration
  • Data loss after container restart: Check that valkey_data volume is properly mounted and not corrupted
  • High memory usage warnings: Monitor container memory with 'docker stats valkey' and adjust dataset size or add memory limits
  • Cannot connect from external host: Verify Docker network configuration and firewall settings for port 6379
  • Valkey server crashes on startup: Check container logs with 'docker logs valkey' for configuration errors or insufficient resources

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Components

valkey

Tags

#valkey#redis#cache#in-memory#open-source

Category

Database Stacks
Ad Space