简体   繁体   English

Redis 没有在 docker 容器中保存数据

[英]Redis is not saving data in the docker container

I have this docker-compose.yml file code:我有这个 docker-compose.yml 文件代码:

version: '3.3'

services:
  redis:
    container_name: redis
    image: 'redis:latest'
    environment:
      X_REDIS_PORT: ${REDIS_PORT}
    ports:
      - ${REDIS_PORT}:${REDIS_PORT}
    volumes:
      - redis:/data

    networks:
      app_network:
            external: true
            driver: bridge
    volumes:
      postgres:
      pgadmin:
      supertoken:
      redis:

I want to save the cached data inside of the redis container but it is not getting saved in the container instead it gets saved on my local machine.我想将缓存数据保存在 redis 容器中,但它没有保存在容器中,而是保存在我的本地机器上。 How to change this behaviour?如何改变这种行为?

inspect your volume,检查你的音量,

docker volume inspect redis

the mountpoint is /var/lib/docker/volumes/, check the redis volumes data.挂载点是/var/lib/docker/volumes/,检查redis卷数据。

I use folder,there is a demo in my github repo ,我使用文件夹,在我的github 仓库中有一个演示,

    volumes:
      - ./data:/data

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM