rabbitmq.conf format or syntax error when done from dockerfile

715 views
Skip to first unread message

Pratik Pradhan

unread,
Mar 12, 2020, 2:04:33 PM3/12/20
to rabbitmq-users
Hi,

I have a dockerfile that uses choco package manager to install rabbitmq 3.8.2 and I need to provide default user and password. So, I have set this up in rabbitmq.conf file in the new format as per the example mentioned on the github site.

I have put this file in a known location directly C:\ and specified the path with RABBITMQ_CONFIG_FILE environment variable.

Although the file is correctly found, the boot  fails due failing of config file reading where I have the syntax error.

BOOT FAILED
===========

Config file generation failed:
19:03:30.170 [error] Syntax error in C:/Users/ContainerAdministrator/AppData/Roaming/RabbitMQ/rabbitmq.conf after line 1 column 1, parsing incomplete
In case the setting comes from a plugin, make sure that the plugin is enabled.
Alternatively remove the setting from the config.

{"init terminating in do_boot",generate_config_file}
init terminating in do_boot (generate_config_file)



PS: I have also tried this with an empty content rabbitmq.conf file but this still gives back the same syntax error. This is strange since there is nothing in the file.



Another attempt was with the old format but then I get:
[error] Unable to parse erlang terms from  RABBITMQ_CONFIG_FILE file: C:\Users\ContainerAdministrator\AppData\Roaming\RabbitMQ\rabbitmq.config
                                Error: {1,erl_scan,{illegal,character}}
{"could not start kernel pid",application_controller,"{badarg,[{code_server,call,1,[{file,\"code_server.erl\"},{line,139}]},{code,load_mods,1,[{fi
le,\"code.erl\"},{line,546}]},{code,ensure_modules_loaded_1,1,[{file,\"code.erl\"},{line,342}]},{io_lib,test_modules_loaded,3,[{file,\"io_lib.erl\
"},{line,257}]},{io_lib,format,2,[{file,\"io_lib.erl\"},{line,186}]},{application_controller,init,2,[{file,\"application_controller.erl\"},{line,5
22}]}]}"}
could not start kernel pid (application_controller) ({badarg,[{code_server,call,1,[{file,"code_server.erl"},{line,139}]},{code,load_mods,1,[{file,
"code.erl"},{line,546}]},{code,ensure_modules_loaded_1

Can someone let me know if they know how to fix this issue?

Thanks.

Luke Bakken

unread,
Mar 12, 2020, 3:16:32 PM3/12/20
to rabbitmq-users
Hello,

We can't help unless you attach the full configuration files you are attempting to use.

Thanks,
Luke

Pratik Pradhan

unread,
Mar 12, 2020, 3:34:45 PM3/12/20
to rabbitmq-users
Hi Luke,

Please find attached files..

I have also tried with empty contents in the file results back in the same error.

Thanks,
Pratik
rabbitmq.conf
rabbitmq.config

Luke Bakken

unread,
Mar 12, 2020, 3:57:25 PM3/12/20
to rabbitmq-users
Hello,

Start from the beginning -

* Remove the RABBITMQ_CONFIG_FILE env variable.
* Delete the configuration files in C:\Users\ContainerAdministrator\AppData\Roaming\RabbitMQ

Does RabbitMQ now start?

Pratik Pradhan

unread,
Mar 12, 2020, 4:07:57 PM3/12/20
to rabbitmq-users
Hi Luke,

Without me providing any configuration files, RabbitMQ starts.

So, with this successful running container I have checked for config files created under the path specified by RABBITMQ_CONFIG_FILE env variable.. where I find that there is no rabbitmq.conf file. But only advanced.conf file with "[]." as its contents.

But to be on safe side this what I have tried..

*Set RABBITMQ_CONFIG_FILE env variable to a path like C:\rabbitmq
*Copy the rabbitmq.conf file attached to this post at the location under C:\

And I have also verified that the file is copied correctly, also without any modifications to its contents.

But I end up with the error provided.

Regards,
Pratik.

Pratik Pradhan

unread,
Mar 12, 2020, 4:11:29 PM3/12/20
to rabbitmq-users
Error for what I have described looks like (main difference as you can observe is the path where it looks for the config file):

BOOT FAILED
===========

Config file generation failed:
19:03:30.170 [error] Syntax error in C:/rabbitmq.conf after line 1 column 1, parsing incomplete
In case the setting comes from a plugin, make sure that the plugin is enabled.
Alternatively remove the setting from the config.

{"init terminating in do_boot",generate_config_file}
init terminating in do_boot (generate_config_file)



Luke Bakken

unread,
Mar 12, 2020, 4:26:56 PM3/12/20
to rabbitmq-users
Hello,

Run RabbitMQ outside of any containers. Does it work without the env variable? Does it work with the env variable?

Luke

On Thursday, March 12, 2020 at 1:07:57 PM UTC-7, Pratik Pradhan wrote:
Hi Luke,

Pratik Pradhan

unread,
Mar 12, 2020, 4:34:27 PM3/12/20
to rabbitmq-users
Hi,

Yes, RabbitMQ  works well outside of containers. But I intend to make RabbitMQ work from a container. I can use the default image provided by RabbitMQ on Docker hub but its based on linux container and my use case is to setup RabbitMQ on windows container.

This also works when I do not use any config file. But by default user is guest where its not possible to remotely access RabbitMQ from the container then. To fix this as suggested in the documentation I can either make my own user or have the configuration set to allow remote connections. This is what I attempt to do by providing the config files myself.

But it doesnt work.

Luke Bakken

unread,
Mar 13, 2020, 1:18:52 PM3/13/20
to rabbitmq-users
Hi Pratik,

Provide the configuration file within the container. The default location is /etc/rabbitmq/rabbitmq.conf

Try that first. You could also set the environment variable inside the container so that RabbitMQ picks it up when it starts.

Thanks,
Luke

Pratik Pradhan

unread,
Mar 16, 2020, 10:45:33 AM3/16/20
to rabbitmq-users
Hi Luke,

I have tried this. So, I have copied a configuration file during building of docker image. Which means the configuration file exists within the container and also set the environment variable to point to this config file location.

Still does not work. The error details are as I have shared at the start of this post.

Dockerfile:

RUN powershell Set-ExecutionPolicy Bypass -Scope Process -Force; \
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

RUN powershell choco install -y rabbitmq --version=3.8.2

RUN ["C:/Program Files/RabbitMQ Server/rabbitmq_server-3.8.2/sbin/rabbitmq-service.bat", "remove"]

RUN refreshenv

EXPOSE 5672 15672

ENV RABBITMQ_CONFIG_FILE "C:\rabbitmq"
COPY rabbitmq.conf .

ENTRYPOINT ["C:/Program Files/RabbitMQ Server/rabbitmq_server-3.8.2/sbin/rabbitmq-server.bat"]


Thanks,
Pratik

Luke Bakken

unread,
Mar 16, 2020, 11:17:37 AM3/16/20
to rabbitmq-users
Hi Pratik,

Could you please share the entire output when you use the configuration below? It can't be exactly the same error as the beginning of this discussion as rabbitmq.conf is not located in C:/Users/ContainerAdministrator/AppData/Roaming/RabbitMQ/rabbitmq.conf

I don't have access to docker on windows at this time so I won't be able to debug this.

Thanks -
Luke

On Monday, March 16, 2020 at 7:45:33 AM UTC-7, Pratik Pradhan wrote:
Hi Luke,

Pratik Pradhan

unread,
Mar 18, 2020, 12:03:25 PM3/18/20
to rabbitmq-users
Hi Luke,

Thank you for the support!

The issue is finally resolved.

The problem with rabbitmq.conf was with ENCODING. Its supposed to be UTF-8 but was UTF-8 BOM.

This encoding was because the .conf file was created using Visual Studio IDE 2017. Later when checked with notepad++, the encoding was incorrect and after changing to UTF-8 encoding, everything works well.

Regards,
Pratik.

Luke Bakken

unread,
Mar 18, 2020, 12:34:54 PM3/18/20
to rabbitmq-users
Hi Pratik,

Thank you for following up with this result. We may be able to handle this scenario in the future.

Luke
Reply all
Reply to author
Forward
0 new messages