If you encounter the error 'Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only' when using DockerProvider service on Windows Server 2019, you can resolve it by implementing one of the following solutions:
- Map a Different Volume:
- Avoid using the default volume mapping, such as '- rabbitmq:/var/lib/rabbitmq', which may lead to permission issues.
- Instead, map a specific subdirectory where the cookie file will be created, for example: '- rabbitmq:/var/lib/rabbitmq/mnesia'.
- Overwrite Docker Image Command:
- Assuming the cookie file is located at '/var/lib/rabbitmq/.erlang.cookie', overwrite the docker image command with the following:
- In your docker-compose file, it would appear as:
- Note that this introduces some technical debt, assuming that the 'rabbitmq-server' command remains unchanged in the future.
["bash", "-c", "chmod 400 /var/lib/rabbitmq/.erlang.cookie; rabbitmq-server"]
... image: rabbitmq:3-management ... ports: - "5672:5672" - "15672:15672" volumes: - ... command: ["bash", "-c", "chmod 400 /var/lib/rabbitmq/.erlang.cookie; rabbitmq-server"]
- Modify docker-compose File:
- In your docker-compose file, add the following environment variable:
- This sets a custom Erlang cookie that will be used by the RabbitMQ container.
rabbitmq: ... environment: RABBITMQ_ERLANG_COOKIE: "rabbitcookie" ...
- Delete '.erlang.cookie' File:
- Locate the '.erlang.cookie' file on your host system.
- Delete the file and restart the Docker container.
- Change File Permissions:
- Find the '.erlang.cookie' file on your host system.
- Change the file permissions to 400 using the 'chmod' command:
chmod 400 .erlang.cookie
- Restart the Docker container.
By implementing one of these solutions, you should be able to resolve the 'Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only' error when using DockerProvider service on Windows Server 2019.