eXo Platform in a Docker Container!

eXo Platform Blog

In this article, we will see just how easy it is to execute the eXo Platform in a Docker container, to make your data persist across container restarts and to plug your eXo Platform deployment into a MySQL database.

To be able to test the content of this article, you need to have the following:

  • Docker 1.11 and above (use Docker4Mac or Docker4Windows if you are on one of these two environments, which do not natively support Docker)
  • Docker Compose 1.7 and above
  • Internet access (for downloading Docker images)
  • Coffee (because downloading Docker images can take longer than actually doing a build with Maven 😉 )

First of all, let’s make it simple and start the Community edition of the eXo Platform in a Docker container. For this, we will use the Docker image called exoplatform/exo-community with its default settings (the first run will of course take the longest because it involves downloading the container):

docker run -ti --rm --name exo \
  -p 8080:8080 \

After some time, you will see this message appear in the logs: Server startup in 58220 ms . This indicates that the eXo Platform is initialized and you can start testing your installation by pointing your browser to http://localhost:8080/. exo-started What would happen now if you stop and recreate your container? The answer is your data will disappear because it has been stored directly within the container itself. To overcome this issue, we will use Docker volumes in order to maintain data outside the container. Let’s start by creating two volumes:

docker volume create --name=data

docker volume create --name=logs

And then restart the eXo Platform in a container using these volumes:     

docker run -ti --rm --name exo \
  -p 8080:8080 \
  -v data:/srv/exo \
  -v logs:/var/log/exo \

From now on, persistent eXo Platform data (including JCR indexes, Values Storage, etc.) will be stored in the data volume, while logs will go in the logs volume. So you can now stop and delete your container and, when starting a new one, find all of your data available. Is that it? Does this mean I can now move to production since my data can now survive container restarts? Certainly not yet as we still don’t have a database suitable for use in production. In fact, unless configured otherwise, our eXo Platform Docker image uses an HSQLDB database that works great for tests but should not be used in production. We will therefore use MySQL 5.5 as our production database. (Note that the eXo Platform does support other database solutions. See here.) Let’s first start our MySQL server in a Docker container:

# MySQL data volume creation
docker volume create --name=mysql_data

# MySQL server start with an exo schema
docker run -d --name mysql \
  -v mysql_data:/var/lib/mysql \
  -e MYSQL_ROOT_PASSWORD=my-secret-pw \
  -e MYSQL_USER=exo \

# Check MySQL logs
docker logs mysql


Now that the database is ready, we can start the eXo Platform while configuring the image so that it uses MySQL. This image, provided by eXo, provides a set of parameters allowing us to adapt the behavior of the image at the time the container is created. (For a detailed list of these parameters, you may refer to this online documentation.)

# creating new clean volumes for eXo Platform persistent data
docker volume create --name=exo_data
docker volume create --name=exo_logs

# starting eXo Platform configured with MySQL
docker run -ti --rm --name exo \
  -p 8080:8080 \
  -v exo_data:/srv/exo \
  -v exo_logs:/var/log/exo \
  --link mysql:mysql \
  -e EXO_DB_TYPE=mysql \
  -e EXO_DB_NAME=exo \
  -e EXO_DB_USER=exo \
  -e EXO_DB_PASSWORD=exo \
  -e EXO_DB_HOST=mysql \
  -e EXO_ADDONS_LIST=exo-jdbc-driver-mysql \

There it is! A new instance of the eXo Platform now connected to a MySQL database. All your user data will of course survive any recreation of your container. Simply login to your new social intranet, invite other people and start collaborating.


So you’re running the eXo Platform in production and all is great. But let’s face it: startup is still a tad complicated. To further simplify this, we will use Docker Compose in order to be able to control our complete environment with one simple command.

To that end, let us first stop and delete all previously started containers:

# stop eXo Platform running container
docker stop exo

# stop MySQL running container
docker stop mysql
docker rm mysql

Next, let us create a docker-compose.yml file with the following content:

version: '2'
    image: exoplatform/exo-community:4.3
      EXO_DB_TYPE: mysql
      EXO_DB_NAME: exo
      EXO_DB_USER: exo
      EXO_DB_PASSWORD: exo
      EXO_DB_HOST: mysql
      EXO_ADDONS_LIST: exo-jdbc-driver-mysql
      - "8080"
      - "8080:8080"
      - exo_data:/srv/exo
      - exo_logs:/var/log/exo
      - mysql
      - mysql
    image: mysql:5.5
      MYSQL_ROOT_PASSWORD: my-secret-pw
      MYSQL_USER: exo
      - mysql_data:/var/lib/mysql
      name: exo_data
      name: exo_logs
      name: mysql_data

We can now start our whole setup (i.e., the MySQL database and the eXo Platform) with the following simple command: docker-compose -f ./docker-compose.yml up .


After this restart with Docker Compose, you will also find no previously created data has been lost.

There are still quite a few things that can be done with the eXo Platform and Docker, so stay tuned to this blog!

In the meantime, the following two links may come in handy for those willing to explore this topic a bit further:

Join The eXo Tribe

Join The eXo Tribe

Register for our Community to Get updates, tutorials, support, and access to the Platform and add-on downloads. Sign in Now!

Related Posts
1 Comment
Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>