docker rabbitmq复制.erlang.cookie后无法启动解决办法
报错信息
errorContext: start_error
reason: {“Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only”,[{auth,init_cookie,0,[{file,“auth.erl”},{line,286}]},{auth,init,1,[{file,“auth.erl”},{line,140}]},{gen_server,init_it,6,[{file,“gen_server.erl”},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,247}]}]}
offender: [{pid,undefined},{id,auth},{mfargs,{auth,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]
可以看到其中很关键的一句
reason: {“Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only”,
意思:
原因:cookie文件必须只允许拥有者有权操作
解决办法
修改本地.erlang.cookie权限,然后复制进去覆盖掉docker 容器里的文件
# 我目前使用的是管理员账号,只给管理员读权限
chmod 400 .erlang.cookie
# 把docker容器里的文件覆盖掉
docker cp ./.erlang.cookie rabbitmq:/var/lib/rabbitmq
# 再启动容器
docker start rabbitmq
# 查看下(结果在下面)
docker ps
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0d3240088f1b rabbitmq:3.6.5-management "docker-entrypoint.s…" 2 days ago Up 1 second 0.0.0.0:4369->4369/tcp, :::4369->4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 15671/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp, 25672/tcp rabbitmq
本文来自博客园,作者:HumorChen99,转载请注明原文链接:https://www.cnblogs.com/HumorChen/p/18039533