docker-redis-cluster icon indicating copy to clipboard operation
docker-redis-cluster copied to clipboard

Add support for passwords

Open melinath opened this issue 7 years ago • 14 comments

It would be great to be able to use docker-redis-cluster and put a password in front of it. It's not clear to me from the existing documentation whether that's possible; I'm fairly certain it isn't.

melinath avatar Oct 02 '18 15:10 melinath

I am not sure if i want to go down this path of adding more and more features that should be configurable somehow because then it could mean that more and more features would want to be added as somehow easy configurable. And it kinda breaks and moves away from the basic idea of this dockerfile as it should be used for a quick bootstrapping of a cluster that you can spin up and use for demos/tests/development and the basic feel from me is that if you need passwords in the base setup, you are probably using it wrong and not for those kinds of intended purposes. Adding a password feels like a production thing.

Grokzen avatar Oct 02 '18 16:10 Grokzen

We use docker in part so that we can have dev/prod parity; we would like to be able to have our development redis setup be as similar as possible to our production redis setup (which is why we're using a cluster in dev at all rather than a single redis instance). Ideally that would include being able to set a password.

melinath avatar Oct 02 '18 17:10 melinath

This is not a blocker for us or anything; we can work around it by configuring our redis location with a URL that does or does not include a password. I get it if it's not a feature you want to support.

melinath avatar Oct 02 '18 17:10 melinath

I will give it some more thought before deciding, but currently i am leaning towards not to support anything config based or dynamic stuff other then the bare minimum essentials like the IP variable that is required to even get it going. The idea of this one is not to have it production grade and compatible with all different types of systems and solutions. This is intended for dev/test types of environment and not much more. I think there is many other containers out there that would be possible to run at production quality instead of this one.

My current recommendation is that you fork this and modify the config file to your needs and run with that. Or you can make a sub image that overrides the config file. The only case i would be willing to accept is to have something super generic that will enable anyone to have the ability to set any key:value in the config file. I am not up to speed with all options that docker support and if there is some new way to inject stuff during startup or not. If you have any suggestion in this direction i will consider it.

Grokzen avatar Oct 02 '18 20:10 Grokzen

This is the discussion on the docker redis image, there are few workarounds. It will be nice if we could at least override the command as in the redis vanilla image. See here:

  redis:
    image: redis:4
    ports:
      - "6379:6379"
    command: "--requirepass secret"
  redis_cluster:
    image: grokzen/redis-cluster:4.0.9
    ports:
      - '7000-7007:7000-7007'
    command: "--requirepass secret"
    environment:
      CLUSTER_ONLY: "true"

It should not be a too terrible change

deddu avatar Oct 03 '18 13:10 deddu

It would require patching the supervisord scripts to allow the injection of the extra stuff. But unless i have access to the content of the variable command inside the container i can't really use it, Maybe patching all cli arguments sent to the docker-entrypoint.sh script and pass it along to redis-server command might work, but not sure if possible.

Grokzen avatar Oct 03 '18 15:10 Grokzen

If can set the password, this is perfect.Waiting for update.

gtfd333 avatar Dec 27 '18 10:12 gtfd333

Fyi @Grokzen -- I implemented the option for both providing authentication for default user as well as a custom user through environment variables set during docker container build. It is backward compatible. LMK if you're intereseted in a PR to review.

hoekma avatar Jan 23 '21 20:01 hoekma

Is there any update on that? @Grokzen you suggested

I think there is many other containers out there that would be possible to run at production quality instead of this one.

I could not find any example that would work with redis-py-cluster. Would appreciate some suggestions of what other image I could use.

kraczak avatar Mar 18 '21 17:03 kraczak

Good idea, I have issues with auth on production, so I want test auth on local, too

phuongdm1987 avatar Mar 27 '21 15:03 phuongdm1987

for those who need authentication, I've fork this repository to support authentication. https://registry.hub.docker.com/r/phuongdm1987/docker-redis-cluster

phuongdm1987 avatar Apr 06 '21 06:04 phuongdm1987

@phuongdm1987 how to set password ? using environment?

tmdgusya avatar Feb 09 '22 02:02 tmdgusya

@phuongdm1987 Can you show me using docker-compose file?

tmdgusya avatar Feb 09 '22 03:02 tmdgusya

@phuongdm1987 Can you show me using docker-compose file?

@tmdgusya Here is the setup in my docker-compose file.

redis-cluster:
    image: 'phuongdm1987/docker-redis-cluster:1.0.0'
    volumes:
      - 'redis-cluster:/data'
    ports:
      - '7000-7005:7000-7005'
    environment:
      DEFAULT_PASSWORD: 'secret'

phuongdm1987 avatar Feb 09 '22 03:02 phuongdm1987