Skip to content

docker-compose 部署 redis

docker-compose.yml

yml
version: "3.9"

services:
  redis:
    image: redis:6.0
    container_name: redis
    restart: always
    hostname: redis
    privileged: true
    ports:
      - 6379:6379
    volumes:
      - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
    command: redis-server /usr/local/etc/redis/redis.conf
    networks:
      - redis-network
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 30s
      timeout: 5s
      retries: 3

  redis-admin:
    image: spryker/redis-commander:0.8.0
    container_name: redis-admin
    hostname: redis-commander
    restart: always
    ports:
      - 10801:8081
    environment:
      - REDIS_HOSTS=local:redis:6379
      - HTTP_USER=admin
      - HTTP_PASSWORD=admin
      - LANG=C.UTF-8
      - LANGUAGE=C.UTF-8
      - LC_ALL=C.UTF-8
    networks:
      - redis-network

    depends_on:
      redis:
        condition: service_healthy

network:
  redis-network:
    driver: bridge

redis.conf

text
bind 0.0.0.0
port 6379

验证

docker-compose-redis

monitor

Released under the MIT License.