Joe Black | me@joeblack.nyc | github
Minimal image with one plugin (rabbitmq-management). This image uses a custom, minimal version of Debian Linux.
Build environment variables are often used in the build script to bump version numbers and set other options during the docker build phase. Their values can be overridden using a build argument of the same name.
ERLANG_VERSION
RABBITMQ_VERSION
The following variables are standard in most of our dockerfiles to reduce duplication and make scripts reusable among different projects:
APP
: rabbitmqUSER
: rabbitmqHOME
/var/lib/rabbitmq
Run environment variables are used in the entrypoint script to render configuration templates, perform flow control, etc. These values can be overridden when inheriting from the base dockerfile, specified during docker run
, or in kubernetes manifests in the env
array.
RABBITMQ_LOG_LEVEL
: lowercased and used as the value for the connection log_level tuple inrabbitmq.config
. Defaults toinfo
.RABBITMQ_DISK_FREE_LIMIT
: used as the value for thevm_memory_high_watermark
tuple in therabbitmq.config
file. Defaults to50MB
.RABBITMQ_VM_MEMORY_HIGH_WATERMARK
: used as the value for thevm_memory_high_watermark
in therabbitmq.config
file. Defaults to0.8
.RABBITMQ_ENABLED_PLUGINS
:,
's are replaced withrabbitmq-plugins enable --offline
before starting rabbitmq. Defaults torabbitmq_management,rabbitmq_management_agent
.
In addition to these, there are numerous other variables recognized by the rabbitmq bash script.
ref: https://www.rabbitmq.com/configure.html
All of our docker-* repos in github have CI pipelines that push to docker cloud/hub.
This image is available at:
- https://hub.docker.com/r/telephoneorg/rabbitmq
- https://store.docker.com/community/images/telephoneorg/rabbitmq
docker pull telephoneorg/rabbitmq
To run:
docker run -d \
--name rabbitmq \
-h rabbitmq \
-e "ERLANG_COOKIE=test-cookie" \
-e "RABBITMQ_USE_LONGNAME=true" \
telephoneorg/rabbitmq
NOTE: Please reference the Run Environment section for a list of available environment variables.
Pull the images
docker-compose pull
Start application and dependencies
# start in foreground
docker-compose up --abort-on-container-exit
# start in background
docker-compose up -d
Edit the manifests under kubernetes/<environment>
to reflect your specific environment and configuration.
Create a secret for the erlang cookie:
kubectl create secret generic erlang --from-literal=erlang.cookie=$(LC_ALL=C tr -cd '[:alnum:]' < /dev/urandom | head -c 64)
Create a secret for the rabbitmq credentials:
kubectl create secret generic rabbitmq --from-literal=rabbitmq.user=$(sed $(perl -e "print int rand(99999)")"q;d" /usr/share/dict/words) --from-literal=rabbitmq.pass=$(LC_ALL=C tr -cd '[:alnum:]' < /dev/urandom | head -c 32)
Deploy rabbitmq:
kubectl create -f kubernetes/<environment>