Skip to content
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

*** FATAL CONFIG FILE ERROR *** passing as parameter redis.conf file #67

Closed
antonioborondo opened this issue Jun 8, 2016 · 4 comments
Closed

Comments

@antonioborondo
Copy link

I am trying to create a Redis cluster node passing as parameter my own redis.conf file with the following configuration:

port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes

I am running the following command to create the cluster node, which seems to be correct according with the documentation:

docker run -v redis.conf:/usr/local/etc/redis/redis.conf --name node redis redis-server /usr/local/etc/redis/redis.conf

But I am getting the following error:

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 2
>>> 'protected-mode "no" "/usr/local/etc/redis/redis.conf"'
Bad directive or wrong number of arguments

If I create my own Dockerfile to add the configuration file inside, it works perfect. But this is not the solution that I pursuit due I need to create nodes with different port numbers.

If I remove the port number from my configuration file, then I create my custom image named "redis-cluster-node" and finally I run the following command to pass the port as parameter:

docker run --name node redis-cluster-node -p 7000

I get the following error:

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 2
>>> 'protected-mode "no" "-p" "7000"'
Bad directive or wrong number of arguments

My configuration file works fine with the original project when I create a cluster node, so I presume the problem is related with the docker image itself or maybe I am missing something.

Can you help me with this? Thanks in advance! 😃

@yosifkit
Copy link
Contributor

yosifkit commented Jun 8, 2016

The error is definitely misleading. I noticed that the volume path was not an absolute path and so that seemed to fix it. Here is what I did:

-docker run -v redis.conf:/usr/local/etc/redis/redis.conf --name node redis redis-server /usr/local/etc/redis/redis.conf

+docker run -v "$PWD"/redis.conf:/usr/local/etc/redis/redis.conf --name node redis redis-server /usr/local/etc/redis/redis.conf

If your volume is not an absolute path on the left (beginning in a /), then docker assumes that is the name of the volume it should create and manage. It does show up in docker volumes, which would mean that redis.conf in the container is a folder, and the entrypoint does not handle that well.

$ docker volume ls
DRIVER              VOLUME NAME
local               redis.conf

@antonioborondo
Copy link
Author

@yosifkit you are right! It works if I pass the absolute path of my redis.conf file 😄

However, the alternative passing the port number as parameter with the -p flag still does not work and I get the same error:

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 2
>>> 'protected-mode "no" "-p" "7000"'
Bad directive or wrong number of arguments

@yosifkit
Copy link
Contributor

yosifkit commented Jun 9, 2016

It looks like all redis flags are -- so that needs to be --port 7000 to work.

@antonioborondo
Copy link
Author

It works with --port. Thank you very much! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants