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

17,898

As I can see here, the log file is not specified and all logs output to the stdout. I wouldn't change this behaviour because in that way docker will manage logs on his own which is standard and even more flexible way.

If you want to redirect logs output somewhere I would suggest using logging directive of the composer.

Share:
17,898
Kery Hu
Author by

Kery Hu

love java ,spring boot ,spring cloud and docker ,and on the way always! love Maths , Big data ,machine learning

Updated on June 04, 2022

Comments

  • Kery Hu
    Kery Hu almost 2 years

    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 ?

  • Kery Hu
    Kery Hu about 8 years
    my target is : add password env in the docker-compose.yml ,, do not care the log path . how resolve?
  • max
    max about 8 years
    Open ~/dbdata/redis_conf/redis.conf, find logfile /var/log/redis/redis-server.log, and replace it with logfile "". That's it.
  • Kery Hu
    Kery Hu about 8 years
    yes,i set log file "", now i start it ok,but another issue -- i already set requirepass 29c4181fb842b5f24a3103dbd2ba17accb1f7e3c8f198689821f7955401a‌​b921 in local redis.conf , and it exists in redis-container 's directory .. but i input config get requirepass it is "", why?
  • max
    max about 8 years
    Where did you input this? I guess you have done it in redis-cli which is outside the container.
  • Kery Hu
    Kery Hu about 8 years
    yes, first docker exec -it redis bash , then redis-cli , i guess i should see the auth , because i have set it
  • max
    max about 8 years
    Try to recreate containers with docker-compose rm and then docker-compose up. This should help.
  • Kery Hu
    Kery Hu about 8 years
    I remove images and docker build again . but ---redisdata_1 | /entrypoint.sh: line 10: exec: --: invalid option redisdata_1 | exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...] springredis_redisdata_1 exited with code 2 redis | 1:C 12 Mar 13:31:10.806 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf redis | _._ and not find requirepass
  • max
    max about 8 years