Last active
June 4, 2018 14:26
-
-
Save ashabhasa/0722b862ca9a3dd1ee03d5abcf8b152d to your computer and use it in GitHub Desktop.
Create rabbitmq image that also creates users and vhosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rabbitmq:3-management | |
# The script was first published here http://mpas.github.io/blog/2015/06/11/setting-up-docker-rabbitmq-with-predefined-users/vhosts/ | |
# Add script to create default users / vhosts | |
ADD init.sh /init.sh | |
# Set correct executable permissions | |
RUN chmod +x /init.sh | |
# Define default command | |
CMD ["/init.sh"] |
Place both files in the same directory and build the image as follows
$ docker build -t my_rabbitmq_image .
then start the container
$ docker run -d --rm=true --name [rabbit-container-name] -p 5672:5672 -p 15672:15672 my_rabbitmq_image
or
$ docker run -d -p 5672:5672 -p 15672:15672 --name [rabbit-container-name] my_rabbitmq_image
example: docker run -d --rm=true --name local-rabbit -p 5672:5672 -p 15672:15672 my_rabbitmq_image
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Find the init.sh file here