Bobcares

Zimbra on Docker Container – How to run

by | Dec 31, 2020

Wondering how to run Zimbra on Docker Container? We can help you.

At Bobcares, we often deal with several docker requests as part of our Server Management Services.

Today, let us see how to run Zimbra on Docker container on CentOS 7 base image.

 

Advantages of Zimbra on Docker Container

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. It consists of a Docker Engine, a portable, lightweight runtime and packaging tool, and Docker Hub.

Cloud service for sharing applications and automating workflows, Docker enables apps to assemble quickly from components. In addition, it eliminates the friction between development, QA, and production environments.

Advantages of using Docker and the ZimbraEasyInstall Script includes:

  • Time-saving
  • Fully automated
  • Easy to use
  • Great for a quick Zimbra Preview

Zimbra on Docker Container

Moving ahead, let us see how our Support Engineers automate Zimbra installation on Docker.

 

Dockerizing Zimbra

First, we need to install Docker on the server we use as a host for the docker containers.

One advantage of docker is that the host OS does not matter, the containers will work on any platform.

Before Dockerizing Zimbra, we create a user-defined docker network for Zimbra. This enables us to define an IP address for the container.

On this setup, the bridge we create is, zimbra_bridge and the network subnet is ipaddress/24 using the command:

# docker network create -d bridge –subnet ipaddress/24 zibra_bridge

Then we confirm the network creation was successful using:

# docker network ls

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

After Dockerizing Zimbra, we get a complete set of email and collaboration tools.

 

Zimbra on Docker container

    1. Download the latest Zimbra Collaboration software. We can download the Open Source edition via:
      wget -O opt/zimbra-install/zcs-rhel7.tgz https://files.zimbra.com/downloads/8.7.1_GA/zcs-8.7.1_GA_1670.RHEL7_64.20161025045328.tgz
    2. Then we edit Makefile if we want to change the name of the base image to build next. The default name is zimbra-rhel-base
      sed -i ‘s/^IMAGE=.*/IMAGE=new-image-name/g’ Makefile
    3. Then we build a Zimbra base image – Which will be the basis for spinning a new container.
      Before running ‘sudo make’, we change the hostname on the file setup.sh to match the final hostname.
      If we plan on using CentOS 7 Docker image, change directive FROM into Dockerfile match centos:latest

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

      The default is from rhel7.3 registry.access.redhat.com
      Similarly, If we use Local repo: On file opt/zimbra-install/zimbra_install_keystrokes, we replace the second line y with n. To look like below:

      $ cat opt/zimbra-install/zimbra_install_keystrokes
      y
      n
      y
      y
      y
      n
      y
      y
      y
      y
      y
      y
      y

      Then edit zimbra.repo to point to correct base repo URL.
      Finally, It is time to create a Zimbra base image:

      sudo make
    4. Later, after a successful build, spin a container from the new Zimbra base image. Use the below run.sh file:
      $ cat run.sh
      #!/bin/bash
      CONT_NAME=”zimbra”
      CONT_DOMAIN=”example.com”
      CONT_S_HOSTNAME=”mail”
      CONT_L_HOSTNAME=”mail.example.com”
      CONT_BRIDGE=”zimbra_bridge”
      CONT_IP=”192.168.2.2″
      ZIMBRA_PASS=”Password321″
      docker run -d –privileged \
      –name “${CONT_NAME}” \
      –hostname zimbra.example.com \
      –net “${CONT_BRIDGE}” \
      –ip “${CONT_IP}” \
      -e TERM=”xterm” \
      -e “container=docker” \
      -e PASSWORD=”${ZIMBRA_PASS}” \
      -e HOSTNAME=”${CONT_S_HOSTNAME}” \
      -e DOMAIN=”${CONT_DOMAIN}” \
      -e CONTAINERIP=”${CONT_IP}” \
      -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 \
      /usr/sbin/init

      Also, we change local variables set on top to suit our environment.

    5. Before starting Zimbra installation, attach to the container Zimbra interactive terminal and execute /bin/bash:
      docker exec -it zimbra /bin/bash

      In the meantime, we can just do:

      sh ./shell.sh

      Once we have active shell access, start automated Zimbra installation:

      cd /opt
      sh ./start.sh

 

  • Access Admin Console

After Dockerizing Zimbra, we can run start.sh

Eventually, the script will take care of everything. After a few minutes we can access the Admin console using:

Admin Console – https://YOUR_HOST_IP:7071

[Finding it hard? Contact us now!]

 

Conclusion

To conclude, Docker enables apps to quickly assemble from components. Today, we saw an effective method our Support Engineers employ to run Zimbra on Docker Container.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF