You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

I’ve been working on  Dockerizing Zimbra on CentOS 7 base image. The hard work has finally yielded fruits and in this post, I’m going to share my Docker Github repository which contains different scripts used.

Dockerizing Zimbra

After Dockerizing Zimbra, you still get a complete set of email and collaboration tools that fits small, medium to large enterprise networks. I’m currently working on autoscaling part and support for automated cluster setups.

Github repository Link

The aim of this is to automate Zimbra installation on Docker. If you encounter any errors be kind to alert me so that I can work on improving.

Dockerizing Zimbra with files in the repo?

Below is the directory tree structure of the files in the repo:

├── Dockerfile
├── etc
│   └── named
│       ├── db.domain
│       └── named.conf
├── Makefile
├── opt
│   ├──
│   └── zimbra-install
│       ├── zcs-rhel7.tgz
│       └── zimbra_install_keystrokes
└── zimbra.repo


Before Dockerizing Zimbra. First, create user-defined docker network for Zimbra. This will enable us to define an forip address the container. On my setup, the bridge created is,zimbra_bridge network subnet is the command:

# docker network create -d bridge --subnet zibra_bridge

Confirm the network is successfully created with:

# docker network ls

NETWORK ID          NAME                DRIVER
f16cc34759a8        none                null                
cd4f9b056c74        host                host                
6fdeb55834bf        bridge              bridge              
8c67bf16fc36        zimbra_bridge       bridge 

Usage and Examples

1. First clone the repo:

git clone

2. Then cd to zimbra-rhel7 directory

cd zimbra-rhel7

3. Download latest Zimbra Collaboration software. I’ll download Open Source edition here.

wget -O opt/zimbra-install/zcs-rhel7.tgz

4. Edit ifMakefile you would like to change the name of the base image to build next. Default name is zimbra-rhel-base

sed -i 's/^IMAGE=.*/IMAGE=new-image-name/g' Makefile 

5. Build Zimbra base image – Will be the basis for spinning new container.

Before running,sudo make consider changing the hostname on to match final hostname you’ll use.

If you plan on using CentOS 7 docker image, change directiveFROM in toDockerfile match.centos:latest

sed -i 's/^FROM .*$/FROM centos:latest/' Dockerfile

The default is

If using Local repo: On fileopt/zimbra-install/zimbra_install_keystrokes, replace the second line y with n. To look like below:

$ cat opt/zimbra-install/zimbra_install_keystrokes

Then edit zimbra.repo to point to correct base repo URL.

It’s now time to create Zimbra base image:

sudo make

6. After a successful build, Spin a container from the new Zimbra base image, see below file for commands to use:

$ cat 

docker run -d --privileged \
    --name "${CONT_NAME}" \
    --hostname \
    --net "${CONT_BRIDGE}" \
    --ip "${CONT_IP}" \
    -e TERM="xterm" \
    -e "container=docker" \
    -e DOMAIN="${CONT_DOMAIN}" \
    -e NAME="${CONT_NAME}" \
    -v /var/"${CONT_L_HOSTNAME}"/opt:/opt/zimbra  \
    -v /etc/localtime:/etc/localtime:ro \
    -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
    -v $(pwd)/zimbra.repo:/etc/yum.repos.d/zimbra.repo \
    -p 25:25 -p 80:80 -p 465:465 -p 587:587 \
    -p 110:110 -p 143:143 -p 993:993 -p 995:995 \
    -p 443:443 -p 8080:8080 -p 8443:8443 \
    -p 7071:7071 -p 9071:9071 \
    zimbra-rhel-base \

Also, change local variables set on top to suite your environment.

If you aren’t using Zimbra local repo remove the line.-v ./zimbra.repo:/etc/yum.repos.d/zimbra.repo It might be a good idea though to set up local repository if playing with docker for the first time; Will save you a lot of time if you screw things up. Visit the link below for how to.

How to Create Local Zimbra Repository

Now spin new Zimbra container:

sh ./

This will launch a container called inzimbra detached mode. We’re detaching because the default command running is,/usr/sbin/init you cannot attach tty terminal.

7. Before starting Zimbra installation, attach to containerzimbra interactive terminal and execute./bin/bash

docker exec -it zimbra /bin/bash

Alternatively, you can just do:

sh ./

Once you have active shell access. Start automated Zimbra installation.

cd /opt
sh ./ 

Accessing Admin Console

After successfully Dockerizing Zimbra. You can run script will take care of everything and after a few minutes you can access Admin console using:

Admin Console – https://YOUR_HOST_IP:7071

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF


Please enter your comment!
Please enter your name here