发布网友 发布时间:2023-04-24 18:23
共1个回答
热心网友 时间:2023-10-12 23:29
我看到这个问题首先想到的就是去docker hub搜官方的redis镜像.然后看了redis的Dockerfile。官方的方法是(对应楼上的1)Additionally, If you want to use your own redis.conf ...You can create your own Dockerfile that adds a redis.conf from the context into /data/, like soFROM redisCOPY redis.conf /usr/local/etc/redis/redis.confCMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]或者$ docker run -v /myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf这个镜像启动的时候就默认运行redis-server了。无法通过docker run -it redis修改。试图docker run -it redis /bin/bash进去覆盖默认的启动命令然后添加自己的配置就好了。希望能帮到你