如何使用DockerProvider服务修复Windows Server 2019中的``Cookie文件/var/lib/rabbitmq/.erlang.cookie仅可由所有者访问''错误

时间:2019-06-19 10:21:14

标签: docker docker-compose rabbitmq windows-server-2019 rabbitmq-management

我在Windows Server 2019中使用DockerProvider安装了docker 我正在使用此代码

Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")

之后,我使用此代码安装Docker-Compose

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\Docker\docker-compose.exe

之后,我使用docker compose文件

version: "3.5"

services:


  rabbitmq:
    # restart: always
    image: rabbitmq:3-management
    container_name: rabbitmq
    ports:
      - 5672:5672
      - 15672:15672
    networks:
      - myname
    # network_mode: host
    volumes: 
      - rabbitmq:/var/lib/rabbitmq



networks:
  myname:
    name: myname-network

volumes:
  rabbitmq:
    driver: local

一切正常 但是在浏览器中调用http://localhost:15672/网址后 rabbitmq崩溃,我在docker logs <container-id>

中看到此错误
Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only

.yml文件在docker for windows中正常工作 但是在Windows Server中运行文件后,我看到此错误

1 个答案:

答案 0 :(得分:0)

解决方案是映射将在其中创建Cookie文件的其他卷;

因此,在您的示例中,不是;

- rabbitmq:/var/lib/rabbitmq

但是;

- rabbitmq:/var/lib/rabbitmq/mnesia