how to save a docker redis container

Data in docker is not persistent, when you restart the container your data will be gone. To prevent this you have to share a map on the host machine with your container. When you container restarts it will get the data from the map on the host.

You can read more about it in the Docker docs: https://docs.docker.com/engine/tutorials/dockervolumes/#data-volumes

From the redis container docs:

Run redis-server

docker run -d --name redis -p 6379:6379 dockerfile/redis

Run redis-server with persistent data directory. (creates dump.rdb)

docker run -d -p 6379:6379 -v <data-dir>:/data --name redis dockerfile/redis

Run redis-server with persistent data directory and password.

docker run -d -p 6379:6379 -v <data-dir>:/data --name redis dockerfile/redis redis-server /etc/redis/redis.conf --requirepass <password>

Source:
https://github.com/dockerfile/redis

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)