Redis Docker镜像使用ACL

3
我希望您能担任中文翻译助手,以下是需要翻译的内容:

我想测试新的Redis 6 ACL配置。我想要运行一个最简单的配置测试来熟悉配置。我的Redis将作为Docker容器运行,请注意我是Redis的完全新手。

我的Dockerfile:

FROM redis:6.2.1

COPY redis.conf /usr/local/etc/redis/redis.conf
COPY users.acl /etc/redis/users.acl

EXPOSE 6379

我的redis.conf文件:
aclfile /etc/redis/users.acl

我的users.acl文件:

user test on >password ~* &* +@all

我能够无误地运行容器,但似乎容器没有加载ACL配置:事实上,当我在容器中运行redis-cli并执行ACL LIST时,输出结果如下:
1) "user default on nopass ~* &* +@all"

很明显这不是预期的结果。

我担心在 Dockerfile 中漏掉了一些东西,但我找不到适合我需求的文档。

有人有提示吗? 提前致谢。


似乎我的 Dockerfile 缺少以下最后一行:CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]。否则,Redis Docker 镜像将在没有配置的情况下运行。 - undefined
1个回答

2

正如此处明确说明:

# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf

在 Dockerfile 中缺少最后一行:
CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]

2
我们如何通过环境变量来实现这个?没有人想要在各个地方维护静态文件。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接