SOGo is a fully fledged groupware server providing a mail client, calendar, address book, CalDAV, CardDAV, Microsoft ActiveSync and more. Despite its feature set there is no official Docker image yet. So let’s create one for ourselves.

SOGo uses Apache to serve the web frontend. We run SOGo and Apache toghther in one Docker container so Apache can easily use the SOGO static files. To start both processes in one Docker container we use supervisord as suggested in the Docker wiki. Both processes run on their own user.

We use the SOGo nightly builds as one needs a paid support contract to get access to the stable releases.

SOGo Dockerfile

SOGo lists several compatible Linux Distributions from which we choose Ubuntu 20.04 as a base for the Docker image. We then roughly follow the SOGo software installation guide and their FAQ entry on how to install nightly SOGo on Ubuntu.

FROM ubuntu:20.04

# Update all packages and install the apt tools to install the rest
RUN apt update && \
apt upgrade -y && \
apt install -y gnupg2 apt-utils ca-certificates apt-transport-https

# Add the PGP Key of SOGo
RUN wget -O- "" | gpg --dearmor | apt-key add -

# Download SOGO from this repo:
COPY SOGo.list /etc/apt/sources.list.d/SOGo.list

# Update apt cache and install SOGo
RUN apt update && \
# Switch to non-interactive install
export DEBIAN_FRONTEND=noninteractive && \
# Do the time zone settings beforehand so we don't get promted for it during install (pick your timezone)
echo "tzdata tzdata/Areas select Europe" | debconf-set-selections && \
echo "tzdata tzdata/Zones/Europe select Berlin" | debconf-set-selections && \
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections && \
# For some reason SOGo wants this file to be present
mkdir -p /usr/share/doc/sogo/ && touch /usr/share/doc/sogo/ && \
# Install the actual services needed
apt install -y --no-install-recommends apache2 sogo supervisor gosu && \
# Prepare non-privileged file permissions for SOGo
chown sogo /etc/sogo/sogo.conf && \
mkdir -p /var/run/sogo && chown sogo /var/run/sogo && \
# Apache also runs on a non-privileged user
mkdir -p /var/run/apache2 && chown www-data /var/run/apache2 && \
# Activate the necessary Apache mods and disable the default site
a2enmod proxy headers proxy_http rewrite && \
a2dissite 000-default && \
# Verify that gosu works
gosu nobody true

# This file is explained below
COPY supervisord/supervisord.conf /etc/supervisord/supervisord.conf

# Supervisord will start Apache and SOGo
CMD exec /usr/bin/supervisord -c /etc/supervisord/supervisord.conf

This is the apt source list that we copy to the image. It just contains the SOGo repository.

deb focal focal

Starting Two Processes in A Docker Container

We use supervisord to start SOGo and Apache in the same docker container. Below is the configuration file for supervisord. Apache will automatically drop root permissions and execute as www-data user. SOGo has to be started as the user it will run as. We will use gosu to start SOGo with the sogo user. We start both processes in foreground as supervisord will take care of them and their output.


command=gosu sogo /usr/sbin/sogod -WONoDetach YES -WOPidFile /var/run/sogo/ -WOLogFile -

command=/usr/sbin/apachectl -DFOREGROUND

Redirecting Logs to Docker

Both SOGo and Apache log to console which will then be picked up by Docker. We set the log target for both processes on the command line. SOGo needs this parameter:

-WOLogFile -

And Apache2 needs a directive to log errors to stderr. (Note: the “c” is intentionally lower case)

-c "ErrorLog /dev/stderr"


Build the container like this:

docker build -t sogo:5.8.2-nightly-0 .

Note that we are using SOGo nightly builds and you should adapt the version number. If you don’t want to build your own container check out my SOGo Docker repository.

Before starting the container you probably should write your own custom SOGo config file as well as a Apache site config, then mount them to the right directory:

docker run -d --name sogo -v /your/sogo.conf:/etc/sogo/sogo.conf -v /your/apache/site.conf:/etc/apache2/sites-enabled/sogo.conf gevattergaul/sogo