Currently I have the below service configured in my docker-compose
which works correct with redis password. However, I would like to use also redis username together with password. Is there any similar command to requirepass
or something else to enable username
?
version: '3.9'
volumes:
redis_data: {}
networks:
ee-net:
driver: bridge
services:
redis:
image: 'redis:latest'
container_name: redis
hostname: redis
networks:
- ee-net
ports:
- '6379:6379'
command: '--requirepass redisPassword'
volumes:
- redis_data:/data
You can specify a config file
$ cat redis.conf
requirepass password
#aclfile /etc/redis/users.acl
Then add the following to your docker compose file
version: '3'
services:
redis:
image: redis:latest
command: ["redis-server", "/etc/redis/redis.conf"]
volumes:
- ./redis.conf:/etc/redis/redis.conf
ports:
- "6379:6379"
Then you will get the password requirements
redis-cli
127.0.0.1:6379> ping
(error) NOAUTH Authentication required.
127.0.0.1:6379> AUTH password
OK
127.0.0.1:6379> ping
PONG
You may want to look into the ACLs line commented out there if you require more fine grained control
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With