docker redis -Can't open the log file: No such file or directory

Viewed 20274

my OS is : ubuntu:15.10

And i want to use the official docker-hub redis , but met problems .

my docker-compose.yml

version: '2'
services:

  redis:
    image: redis
    ports:
      - "6379:6379"
    volumes:
      -  ~/dbdata/redis_conf/redis.conf:/usr/local/etc/redis/redis.conf
    volumes_from:
      -  redisdata
    environment:
      - REDIS_PASSWORD: 29c4181fb842b5f24a3103dbd2ba17accb1f7e3c8f19868955401ab921
    command: redis-server /usr/local/etc/redis/redis.conf

redisdata:
    image: redis
    volumes:
      - /home/keryhu/dbdata/redisdb:/data
    command: --break-redis

I copy the default redis.conf to the "~/dbdata/redis_conf/redis.conf" directory . And just modify the "requirepass" to "29c4181fb842b5f24a3103dbd2ba17accb1f7e3c8f19868955401ab921"

when i start the container ,i met an error -

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 103
>>> 'logfile /var/log/redis/redis-server.log'
Can't open the log file: No such file or directory

Can help me ?

2 Answers

I happened to have encountered this problem too.Finally, i touched the redis.log on my host, then mount it on docker. step1: touch /yourself's location/redis-server.log docker run -d -v /yourself's location/redis-server.log:/var/log/redis/redis-server.log -v /your/redis.config:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf if you want to mount a file or dir,they must exist firstly,otherwise,it occours permission denied or empty dir.

Related