diff --git a/Dockerfile b/Dockerfile
index d5368a2fe65001dbc14336ffa2aa97060f8bc340..8012b134d4864aed12a4a138d7dd8a0b1c7187ed 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -11,20 +11,51 @@ ENV DEBIAN_FRONTEND noninteractive
 ENV DEBIAN_PRIORITY critical
 ENV DEBCONF_NOWARNINGS yes
 
+# Upgrade packages
+RUN \
+  apt-get -y update && \
+  apt-get -y upgrade
+
 # Set Timezone
-RUN echo "Europe/Stockholm" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
+RUN \
+  echo "Europe/Stockholm" > /etc/timezone && \
+  dpkg-reconfigure -f noninteractive tzdata
 
 # Fix locale
-RUN locale-gen en_US.UTF-8
-RUN echo "LANG=\"en_US.UTF-8\"" > /etc/default/locale && echo "LANGUAGE=\"en_US:en\"" >> /etc/default/locale
+RUN \
+  locale-gen en_US.UTF-8 && \
+  echo "LANG=\"en_US.UTF-8\"" > /etc/default/locale && \
+  echo "LANGUAGE=\"en_US.UTF8\"" >> /etc/default/locale && \
+  echo "LC_ALL=\"en_US.UTF8\"" >> /etc/default/locale
+
+# Import self-signed cert as trusted CA
+RUN \
+  mkdir -p /usr/share/ca-certificates/extra && \
+  openssl s_client -servername cert.codemate.se -connect codemate.se:443 </dev/null | sed -ne '/--BEGIN CERTIFICATE--/,/--END CERTIFICATE--/p' > /usr/share/ca-certificates/extra/codemate.crt && \
+  update-ca-certificates && \
+  keytool -import -noprompt -trustcacerts -keystore /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts -storepass changeit -noprompt -alias codemate-self-signed -file /usr/share/ca-certificates/extra/codemate.crt
+
+# Install and configure Exim
+RUN \
+  apt-get -y install exim4-daemon-light && \
+  sed -i -e "s/dc_eximconfig_configtype='local'/dc_eximconfig_configtype='internet'/" /etc/exim4/update-exim4.conf.conf && \
+  sed -i -e "s/127.0.0.1/0.0.0.0/" /etc/exim4/update-exim4.conf.conf && \
+  update-exim4.conf
+
+# Install and configure MySQL
+RUN \
+  apt-get -y install mysql-server && \
+  sed -i -e "s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
 
 # Default Environment
-ENV CONFLUENCE_VERSION 5.4.3
+ENV CONFLUENCE_VERSION 5.5.4
 ENV CONFLUENCE_HOME /home/confluence
 
 # Add startup script
 ADD init.sh /init.sh
 
+# Expose ports
+EXPOSE 25 3306 8090 8091
+
 # Start Confluence
-EXPOSE 8091
 CMD ["sh", "/init.sh"]
diff --git a/README.md b/README.md
index 25d9489f9837896d9b663c174ae51ddc0c9b79ac..39b2ad28096c0716e7cff4ea5a335b346d643984 100644
--- a/README.md
+++ b/README.md
@@ -19,10 +19,10 @@ docker run -d registry.codemate.se/confluence
 
 ### Customize exposed port
 
-By default, the port `8091` (web interface) is mapped to a random port on the docker host. To customize, run:
+By default, the port `8090` (web interface) is mapped to a random port on the docker host. To customize, run:
 
 ```
-docker run -p 8091:8091 -d registry.codemate.se/confluence
+docker run -p 8090:8090 -d registry.codemate.se/confluence
 ```
 
 More info about port redirection can be found in the official Docker [documentation](http://docs.docker.io/en/latest/use/port_redirection/).
@@ -39,37 +39,55 @@ docker run -v /data/confluence:/home/confluence -d registry.codemate.se/confluen
 
 ### Running a different Confluence version
 
-By default, the container downloads and installs Confluence v5.4.3 on the first boot. To specify which version to install, set the environment variable `CONFLUENCE_VERSION`:
+By default, the container downloads and installs Confluence v5.5.4 on the first boot. To specify which version to install, set the environment variable `CONFLUENCE_VERSION`:
 
 ```
-docker run -e CONFLUENCE_VERSION=5.4.3 -d registry.codemate.se/confluence
+docker run -e CONFLUENCE_VERSION=5.5.4 -d registry.codemate.se/confluence
 ```
 
 ### Overiding Confluence files
 
-By providing an environment variable name `CONFLUENCE_OVERLAY` that points to a gzipped tar file you can apply an overlay on the Confluence installation. This tarball will be unzipped and extracted in the root of the Confluence installation directory. The overlay enables you to add custom confluence configuratios such as SSL or Crowd integration.
+By providing an environment variable name `CONFLUENCE_OVERLAY` that points to a directory or URL of a gzipped tar file you can apply an overlay on the Confluence installation. A directory will be recursively copied, and a tarball will be unzipped and extracted in the root of the Confluence installation directory. The overlay enables you to add custom confluence configurations such as SSL or Crowd integration.
 
 ```
 docker run -e CONFLUENCE_OVERLAY=http://10.0.0.1/confluence-config.tgz -d registry.codemate.se/confluence
+docker run -e CONFLUENCE_OVERLAY=/tmp/confluence-config -d registry.codemate.se/confluence
 ```
 
-The overlay is fetched using curl so if you need to provide basic auth credentials simply prefix the url with the credentials, for example:
+The overlay is fetched using curl so file URLs are valid:
+
+```
+CONFLUENCE_OVERLAY="file:///tmp/confluence-config.tgz"
+```
+
+If you need to provide basic auth credentials simply prefix the url with the credentials, for example:
 
 ```
 CONFLUENCE_OVERLAY="-u username:password http://10.0.0.1/confluence-config.tgz"
 ```
 
+### Initializing MySQL
+
+By providing an environment variable name `MYSQL_INIT` that points to an SQL script you initialize the MySQL database.
+
+```
+docker run -e MYSQL_INIT=http://10.0.0.1/confluence-init.sql -d registry.codemate.se/confluence
+```
+
+Basic auth credentials and file URLs can be used as mentioned in the overlay section.
+
 ### Combined options
 
 The following example shows the options we use for our CI environment:
 
 ```
-docker run -name confluence \
+docker run \
+  --name confluence \
   -e JAVA_OPTS=-Xmx1024m \
-  -e CONFLUENCE_VERSION=5.4.3 \
+  -e CONFLUENCE_VERSION=5.5.4 \
   -e CONFLUENCE_OVERLAY=http://10.0.0.1/confluence-config.tgz \
   -v /opt/application-data/confluence:/home/confluence \
-  -p 8091:8091 \
+  -p 8090:8090 \
   -d registry.codemate.se/confluence
 ```
 
@@ -83,7 +101,11 @@ docker run -name confluence \
 * `CONFLUENCE_HOME` - Confluence home directory (default `/home/confluence`)
 * `CONFLUENCE_VERSION` - The version to install an run (default `5.4.3`)
 * `CONFLUENCE_OVERLAY` - A URL pointing to an tarball overlay
+* `MYSQL_INIT` - A URL pointing to an SQL script
 
 ## Exposed ports
 
-* `8091` - Confluence web interface
+* `25` - Exim SMTP
+* `3306` - MySQL
+* `8090` - Confluence web interface
+* `8091` - Confluence web interface (extra)
diff --git a/init.sh b/init.sh
index 9e6f2170316be9b17c91132db0dd0a00a2a3c340..e0aa8528f6d41f13ebfb8012d5a861a5cb709f4a 100644
--- a/init.sh
+++ b/init.sh
@@ -2,26 +2,45 @@
 
 set -e # Exit on errors
 
-SEPARATOR="-------------------------------------------------------------------------------"
 CONFLUENCE_DIR=/opt/atlassian-confluence-$CONFLUENCE_VERSION
-
-if [ ! -d $CONFLUENCE_HOME ]; then
-    mkdir -p $CONFLUENCE_HOME
-fi
+MYSQL_DIR=$CONFLUENCE_HOME/mysql-data
 
 if [ ! -d $CONFLUENCE_DIR ]; then
     curl -s -v -L http://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-$CONFLUENCE_VERSION.tar.gz | tar xzf - -C /opt
-	echo "$SEPARATOR"
 fi
 
 if [ ${CONFLUENCE_OVERLAY:+x} ] && [ -d $CONFLUENCE_DIR ]; then
-    curl -s -v -L $CONFLUENCE_OVERLAY | tar xzf - -C $CONFLUENCE_DIR
-	echo "$SEPARATOR"
+    if [ -d $CONFLUENCE_OVERLAY ]; then
+        cp -R $CONFLUENCE_OVERLAY/* $CONFLUENCE_DIR
+    else
+        curl -s -v -L $CONFLUENCE_OVERLAY | tar xzf - -C $CONFLUENCE_DIR
+    fi
 fi
 
 chown -R root:root $CONFLUENCE_DIR
 
+if [ ! -d $CONFLUENCE_HOME ]; then
+    mkdir -p $CONFLUENCE_HOME
+fi
+
+sed -i -e "s#^user\s*=\s*mysql#user = root#" /etc/mysql/my.cnf
+sed -i -e "s#^datadir\s*=\s*/var/lib/mysql#datadir = $MYSQL_DIR#" /etc/mysql/my.cnf
+if [ ! -d $MYSQL_DIR ]; then
+    mkdir -p $MYSQL_DIR
+    mysql_install_db
+    mysqld_safe &
+    sleep 5s
+else
+    mysqld_safe &
+    sleep 5s
+fi
+
+if [ ${MYSQL_INIT:+x} ] && [ -d $MYSQL_DIR ]; then
+    curl -s -v -L $MYSQL_INIT | mysql
+fi
+
 env | sort
-echo "$SEPARATOR"
+
+exim4 -v -bdf -q15m &
 
 exec $CONFLUENCE_DIR/bin/start-confluence.sh -fg