-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Losing the Redis data after restart docker, please help #1210
Comments
I suspect you're bind-mounting your data directory to the wrong location in the container. Note that unlike the official Redis image from Docker Hub (https://hub.docker.com/_/redis), which stores persistent data in
Generally, I would recommend using the official Redis image from Docker Hub; https://hub.docker.com/_/redis, which also provide multi-arch images (allowing deployment on different architectures); be sure to read the "start with persistent storage" section in the documentation for the image on Docker Hub; https://hub.docker.com/_/redis If you need to use the bitnami variant, be sure to read their documentation as well, to use the correct paths and configuration to persist your data (https://hub.docker.com/r/bitnami/redis) Please keep in mind that the GitHub issue tracker is not intended as a general support forum,
I'm closing this issue because this is not a bug, but feel free to continue the conversation |
@thaJeztah Thanks for the answer! But I also tried to do it by official Redis, but doesn't work. Please help.. redis:
image: redis:latest
container_name: face_redis
restart: always
command:
- 'redis-server'
- '--loglevel ${REDIS_LOGLEVEL:-warning}'
- '--databases 2'
- '--save 900 1'
- '--save 300 10'
- '--save 60 10000'
- '--maxmemory ${REDIS_MAXMEM:-50mb}'
- '--maxmemory-policy ${REDIS_POLICY:-noeviction}'
- '--requirepass ${REDIS_PASSWORD}'
ports:
- "6379:6379"
volumes:
- ./docker/redis/data:/data
environment:
- REDIS_REPLICATION_MODE=master
networks:
- internal |
(also note that the |
@thaJeztah yes I see data in ./docker/redis/data. I updated docker-compose, added --appendonly yes, but doesn't work.. After restart docker lost data from volumes... I lost more than 3 days on this. redis: |
Do you mean your |
@thaJeztah file exists, but data that was cached before docker restart is lost.. |
If you're running on Linux, then the
With |
@thaJeztah This is my Ubuntu remote server. Redis saves work fine. Docker restarts means docker-compose down and then docker-compose up --build. Yes, this is my home-directory. |
Not sure I have answers for your situation, and I would have to dive into that situation myself, but that's really out of scope for this issue tracker (it's very unlikely to be an issue with the docker daemon itself) I did a quick search, and there's an old ticket on the issue tracker for the redis image about this; #1210, and I see an open ticket that may be related redis/docker-library-redis#262. Perhaps those provide more details to help you debug. |
@thaJeztah this ticket 1210 is mine. Okay, thanks for trying. |
Ah, sorry must've had the wrong url on my clipboard; this was the old issue I tried to link redis/docker-library-redis#4 |
I had this issue and found that simply binding the data directory to a named volume with the appendonly flag solved the issue. Also I was using the redis:alpine image:
Hope this helps anyone with this issue in the future. |
Expected behavior
Don't lose Redis data from volume after restart docker.
Actual behavior
Lose the Redis data after the restart docker. My docker-compose is
`
redis:
`
Steps to reproduce the behavior
Changed volumes, changed Redis image, added commands.
Output of
docker version
:Additional environment details (AWS, VirtualBox, physical, etc.)
The text was updated successfully, but these errors were encountered: