1001Ferramentas
πŸ”΄Dev

docker-compose Redis Generator

Generates a ready-to-use docker-compose for Redis, publishing port 6379 with a persistent volume. Pick the image tag and spin up your local cache or broker with one command.

YAML

β€”

Local Redis for cache or queues

Any project with Celery, Sidekiq, BullMQ or session caching needs a Redis running somewhere, and installing it on the machine means remembering to uninstall it later. Pick the image tag (7-alpine, 7.2, whatever the project uses) and copy the YAML: a redis service, port 6379 published and the rdata volume mounted at /data, which is the working directory of the official image.

The image version is the only field, and that shapes what comes out: no password, no persistence tuning in the generated file. Redis starts with factory defaults, which write RDB snapshots into /data, and that is what makes the volume worth having; AOF stays off. To change either, add a command line to the service, such as redis-server --appendonly yes --requirepass yourpassword.

Publishing 6379 on an internet-reachable host with no password invites automated scanning, and exposed Redis instances have been a well known target for years. On a development machine it is fine. On a VPS, switch to 127.0.0.1:6379:6379 or drop the ports section entirely and rely on the internal Compose network, keeping in mind that the rule Docker adds does not respect ufw. The YAML is built in your browser.

Frequently asked questions

Where do I put the Redis password?
On a command line inside the service: command: redis-server --requirepass yourpassword. The tool does not generate that field, so it is a manual edit after copying.
Do I lose data when the container restarts?
No, because the RDB snapshot lives in the rdata volume. RDB writes on an interval though, so an abrupt crash can cost the last few seconds. Turn on appendonly for stronger durability.
Can I use it as a queue broker?
That is the most common use. From another container in the same compose file, point the URL at redis://redis:6379/0, using the service name as the host.

Related Tools