Yes, Docker secrets can be used to read the Redis password from /run/secrets/ and assign it to the Redis --requirepass parameter.
To do this, you can create a secret with the Redis password using the following command:
$ docker secret create redis-pass /path/to/redis-pass.txt
Next, you can pass the secret to the Redis service using the --secret flag when creating the service. For example:
$ docker service create \
--name redis \
--secret redis-pass \
redis:latest \
redis-server --requirepass $(cat /run/secrets/redis-pass)
This will create a Redis service with the --requirepass parameter set to the value of the redis-pass secret. The $(cat /run/secrets/redis-pass) command reads the value of the secret from the /run/secrets/redis-pass file.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-09-12 11:00:00 +0000
Seen: 9 times
Last updated: Sep 27 '22