Skip to content

Redis Docker Setup

Fill in the target environment to generate Docker scripts you can copy onto a Linux host. This page uses the same generator as RedisME's in-app Redis Install helper.

Docker only (docker run / Compose) — not bare-metal, systemd, or Kubernetes. Cluster and Sentinel use host networking; enter a reachable host IP. For TLS, generate an openssl script on TLS Certificate.

See also: Docker Hub · Official Install Doc

Deploy Mode
TLSImage
PortPasswordMount DataVolume ConfTimezone
bash
# ================================================================
# Prepare Environment
# ================================================================
mkdir -p /data/redis-single/conf /data/redis-single/data

# ================================================================
# Write Config Files
# ================================================================
cat > /data/redis-single/conf/redis.conf <<'EOF'
port 6379
bind 0.0.0.0
protected-mode no
dir /data
EOF

chown -R 999:999 /data/redis-single

# ================================================================
# Start Containers
# ================================================================
cat > /data/redis-single/docker-compose.yml <<'EOF'
services:
  redis-6379:
    image: redis:8
    container_name: redis-6379
    ports:
      - '6379:6379'
    restart: unless-stopped
    environment:
      - TZ=Asia/Shanghai
    volumes:
      - /data/redis-single/data:/data
      - /data/redis-single/conf:/etc/redis/conf
    command: redis-server /etc/redis/conf/redis.conf
EOF

cd /data/redis-single
# Review and adjust if needed
# vim docker-compose.yml
docker compose up -d
# docker compose logs

# ================================================================
# Verify
# ================================================================
docker exec redis-6379 redis-cli -p 6379 ping