Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only' error in windows server 2019 with DockerProvider service

I'm installed docker in windows server 2019 with DockerProvider I'm using this code

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

after that I install Docker-Compose with this code

[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

after that I use a docker compose file

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

everything is Ok up to here but after i call http://localhost:15672/ url in my browser rabbitmq crashes and I see this error in docker logs <container-id>

Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only

this .yml file is working correctly in docker for windows but after running the file in windows server, I see this error

like image 751
d.borzouei Avatar asked Nov 06 '22 16:11

d.borzouei


1 Answers

Solution is to map a different volume where the cookie file will be created;

  • https://github.com/docker-library/rabbitmq/issues/171#issuecomment-316302131

So for your example, not;

- rabbitmq:/var/lib/rabbitmq

but;

- rabbitmq:/var/lib/rabbitmq/mnesia
like image 59
alv Avatar answered Nov 14 '22 22:11

alv