Sign inSign up

vothanhlong741/redis-ssl

By vothanhlong741

Updated 6 days ago

Redis is the world’s fastest data platform for caching, vector search, and NoSQL databases.

Image
Developer tools
Databases & storage
0

2.0K

vothanhlong741/redis-ssl repository overview

Redis SSL/TLS Enabled Container

Docker Hub

A Redis image with TLS/SSL support, self-signed certificate generation, and environment-based configuration. Supports both TLS and non-TLS connections simultaneously.

Quick Start

# Pull
docker pull vothanhlong741/redis-ssl:latest

# Run with TLS enabled
docker run -d \
  --name redis-ssl \
  -p 6379:6379 \
  -p 6380:6380 \
  -e REDIS_ENABLE_TLS=yes \
  -e REDIS_DEFAULT_PASSWORD=mydefaultpassword \
  -e REDIS_AUTH_USERNAME=myuser \
  -e REDIS_AUTH_PASSWORD=mypassword \
  vothanhlong741/redis-ssl:latest

Environment Variables

VariableDefaultDescription
REDIS_ENABLE_TLSnoEnable TLS mode (yes or no)
REDIS_ENABLE_PORTyesEnable non-TLS port (yes or no)
REDIS_TLS_PORT6380TLS port number
REDIS_PORT6379Non-TLS port number
REDIS_TLS_SAN_DOMAINS(none)Additional SAN entries, comma-separated (e.g. host1,host2)
REDIS_ENABLE_TLS_AUTH_CLIENTnoRequire client certificates for TLS (yes or no)
REDIS_DEFAULT_PASSWORDdefaultDefault user's password
REDIS_AUTH_USERNAME(none)Additional user for authentication
REDIS_AUTH_PASSWORD(none)Additional user's password

When REDIS_ENABLE_TLS=yes, self-signed certificates are generated in /opt/certs/ and the TLS port is enabled. The non-TLS port behavior depends on REDIS_ENABLE_PORT.

TLS Only (No Non-TLS Port)

docker run -d \
  --name redis-ssl \
  -p 6380:6380 \
  -e REDIS_ENABLE_TLS=yes \
  -e REDIS_ENABLE_PORT=no \
  -e REDIS_DEFAULT_PASSWORD=mydefaultpassword \
  vothanhlong741/redis-ssl:latest

Docker Compose

services:
  redis:
    image: vothanhlong741/redis-ssl:latest
    ports:
      - "6379:6379"
      - "6380:6380"
    environment:
      - REDIS_ENABLE_TLS=yes
      - REDIS_DEFAULT_PASSWORD=defaultpass
      - REDIS_AUTH_USERNAME=appuser
      - REDIS_AUTH_PASSWORD=secretpassword
      - REDIS_ENABLE_TLS_AUTH_CLIENT=no
    volumes:
      - redis-data:/data

volumes:
  redis-data:

Connecting

TLS:

redis-cli -h localhost -p 6380 --tls \
  --cert /opt/certs/server.crt \
  --key /opt/certs/server.key \
  --cacert /opt/certs/root.crt \
  -a mypassword

Non-TLS:

redis-cli -h localhost -p 6379 -a mypassword

Generated Files

PathDescription
/opt/redis/system.confRedis configuration (generated)
/opt/certs/server.crtTLS server certificate
/opt/certs/server.keyTLS private key
/opt/certs/root.crtCA certificate

Persistent Data

docker run -d \
  --name redis-ssl \
  -v redis-data:/data \
  -e REDIS_ENABLE_TLS=yes \
  vothanhlong741/redis-ssl:latest

Security

  • Always use TLS when exposing Redis to untrusted networks
  • Set strong passwords using REDIS_DEFAULT_PASSWORD and REDIS_AUTH_PASSWORD
  • Disable non-TLS port when TLS-only is required: REDIS_ENABLE_PORT=no
  • Enable client certificates for mTLS: REDIS_ENABLE_TLS_AUTH_CLIENT=yes

Image Details

Tag summary

Content type

Image

Digest

sha256:47ac5be16

Size

46.6 MB

Last updated

6 days ago

docker pull vothanhlong741/redis-ssl