Community Solution

Install Redis on CasaOS with Docker Compose Safely

A 2023 CasaOS tutorial introduced Redis installation but did not cover current persistence, authentication, or safe network exposure.

The safest current way to run Redis on CasaOS is as a Docker container with a persistent data volume and explicit authentication/network exposure. The 2023 forum tutorial is too old to be used as the whole deployment guide, because current Redis defaults and security expectations have moved on.

Start with the official Redis image, keep port 6379 private to the LAN or Docker network, persist /data, and decide whether you need AOF/RDB persistence before putting application data into it.

Use the Official Redis Image

The current Redis Docker guide documents the official redis:<version> image and standard port 6379.

Use Docker Compose on CasaOS

services:
  redis:
    image: redis:8
    container_name: redis
    restart: unless-stopped
    command: ["redis-server", "--appendonly", "yes", "--requirepass", "CHANGE_ME"]
    volumes:
      - /DATA/AppData/redis/data:/data
    ports:
      - "127.0.0.1:6379:6379"

Change the password and adjust the bind address only if another host truly needs direct Redis access.

Persist /data

Without a host volume, Redis data lives inside the disposable container layer and can disappear when the container is recreated. Map /data to durable CasaOS storage.

Choose Persistence Deliberately

AOF records writes and improves recoverability, while RDB snapshots are lighter-weight. Your application may also tolerate Redis as an ephemeral cache. Match the persistence mode to what Redis is doing for you.

Do Not Expose Redis Directly to the Internet

Port 6379 should not be publicly forwarded. If another application runs on the same Docker host, put both containers on a private Docker network and connect by service name.

Use Authentication and ACLs

A single requirepass is simple for home use, while current Redis also supports ACLs for more granular users and commands. Do not leave a remotely reachable Redis instance unauthenticated.

Test from redis-cli

docker exec -it redis redis-cli -a CHANGE_ME ping

A healthy server should return PONG.

Back Up Persistent Redis Data

If Redis holds anything important, stop or coordinate writes and back up the persistent volume according to your chosen RDB/AOF method. Do not assume container restart equals backup.

The Docker deployment guide applies equally to CasaOS custom apps.

Check Memory Limits Before Production Use

Redis is memory-first software. Watch actual dataset size and host RAM instead of assuming a small key count means a small footprint. For a shared CasaOS host, consider a deliberate maxmemory policy only after understanding how your application reacts to eviction.

Use a Private Docker Network for App Dependencies

If Redis exists only for another container such as an automation platform or web app, place both services on the same private Docker network and omit the host port entirely. The application can connect to redis:6379 by service name.

Verify Persistence After a Container Recreate

After initial setup, write a test key, recreate the container with the same volume, and confirm the key is still available. This simple test proves the host path is actually persistent before an important application depends on it.

FAQ

What port does Redis use?

6379 by default.

Should I map 6379 to every interface?

No. Bind only where needed, preferably localhost or a private Docker/LAN path.

Where should Redis data live?

Map the container's /data directory to persistent CasaOS storage.

Do I need RedisInsight?

No. It is optional management UI; Redis itself works without it.