Ask Your Question
2

Can Docker secrets be employed to read the redis-pass from /run/secrets/ and assign it to the redis --requirepass parameter?

asked 2021-09-12 11:00:00 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-09-27 09:00:00 +0000

nofretete gravatar image

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.

edit flag offensive delete link more

Your Answer

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

Add Answer


Question Tools

Stats

Asked: 2021-09-12 11:00:00 +0000

Seen: 9 times

Last updated: Sep 27 '22