Dockerized zookeeper customizeable with env varaibles
It appeared that other zookeeper images cannot make a cluster
or change configuration without bind-mounting config file.
This one can be configured with bind-mounting and
with env variables. This image can even form zookeeper cluster
from env variables only.
Zookeeper is installed from ubuntu repositories on top of 14.04.
Single-node super-simple setup:
docker run -d -p 2181:2181 -e ZK_CONFIG=clientPort=2181 -e ZK_ID=1 bobrik/zookeeper
Same as single node, but you should add more configuration to
some production-ready string could look like this for 3-node cluster:
You should also expose ports
in addition to
2181 to make it work.
Each node should be launched with correct
If you already have configuration file, you should mount it
to container's dir
It is a great idea to persist data on host filesystem.
To do so, please bind-mount
/var/lib/zookeeper for data
/var/log/zookeeper for logs.