Public | Automated Build

Last pushed: 2 years ago
Short Description
This is an image for apache zookeeper based on ubuntu:trusty docker image
Full Description


This is an image for apache zookeeper based on ubuntu:trusty docker image

Supported tags and respective Dockerfile links:


The container has default environment variables that shouldn't be touched:

Environment Variable Description Value
ZOOKEEPER_HOME home directory where zookeeper is installed /opt/zookeeper/
ZOOKEEPER_CONFIG_FILE configuration file for zookeeper /opt/zookeeper/conf/zoo.cfg

To run container in standalone mode just don't set ZK_ID environment variable:

docker run -d -ti --publish 2181:2181 --name zookeeper vasylpurchel/zookeeper

Or it can be used in replicated mode:

docker run -d -ti -e ZK_CLIENT_PORT="2181" -e ZK_SERVERS="" -e ZK_ID=1 --publish 2181:2181 --publish 2888:2888 --publish 3888:3888 --name zookeeper-node-1 vasylpurchel/zookeeper

To configure zookeeper instance you can use environment variables that starts with a same name as zookeeper configuration entries with ZK_ prefix, uppercase and words splitted by _

Few examples:

Environment Variable Zookeeper Property

By default only ZK_DATA_DIR is set to /tmp/zookeeper and in zoo.cfg file default values are:

Zookeeper Property Default value
tickTime 2000
clientPort 2181
dataDir /tmp/zookeeper

To save data you need to mount volume to ZK_DATA_DIR:

docker run -d -ti -v /data/zookeeper:/tmp/zookeeper --publish 2181:2181 --name zookeeper vasylpurchel/zookeeper is generating configuration for container and runs any parameters after,
so you can use this image to run other zookeeper related tasks and not only starting server in foreground(default one)


Make sure you are in zookeeper folder and that ip address in docker-compose.yml file is correct (mine is while default is

ifconfig | grep "docker0" -C 2 | grep "inet addr"

build image:

docker build -t vasylpurchel/zookeeper .

run 3 nodes from docker-compose:

docker-compose up

check that it works just run:

for i in {2181..2183}; do echo mntr | nc $i | grep zk_followers ; done


  • --net=host is used to tell docker containers to use host network, so this instances will be able to comunicate between themselves, need to be changed to overlay network so we can have multi-host network that will be using it
Docker Pull Command
Source Repository

Comments (0)