rabbitmqdockervagrantfile

Remotely create a vhost on a docker container running rabbitmq


I have a Vagrantfile that does 2 important things; firstly pulls and runs dockerfile/rabbitmq, then builds from a custom Dockerfile that runs an application which assumes a vhost on the rabbitmq server, let's say "/foo".

The problem is the vhost is not there.

The container with rabbitmq is running successfully, the app is linked to it using --link as the built image is run. Using the environment variables docker sets I can hit the server. But somewhere in the middle of these operations I need to create the vhost as my connection is refused, i assume because "/foo" is not there.

How can I get the vhost onto the rabbit server?

Thanks

note - using the webadmin is not an option, this has to be done programatically.


Solution

  • You can put default_vhost in /etc/rabbitmq/rabbitmq.config: http://www.rabbitmq.com/configure.html

    It will then be created on the first run. (Stop and delete the mnesia directory if has been started already)