Run Baïkal through Docker
I’ve been using it for my calendars and adressbooks already for more than 4 years now. However, I initially installed it as plain PHP application with a MySQL database. The developers also announced quite early, that they are working on a Docker image, but there is nothing useful as of mid 2018. So far they just provide a quite inconvenient how-to and a list of issues that apparently prevent them from providing a proper Docker image. Thus, I just dockerised the application myself :)
The Docker image
Actually, creating a Docker image for Baïkal was super easy. In the end, it is “only” a PHP application ;-) The corresponding Dockerfile can be found in the root directory of Baïkal’s git repository (at least in my fork). The latest version at the time of writing is:
So, it basically
- installs some dependencies through
- installs the PDO-MySQL extension,
- installs composer,
- adds the Baikal sources into the image,
- and finally installs remaining Baikal dependencies through composer.
I distribute the image as binfalse/baikal.
Using the Docker image
Using the image is fairly simple.
Basically, you only need to mount some persistent space to
docker run -it --rm -p 80:80 -v /path/to/persistent:/var/www/Specific binfalse/baikal
Please make sure that the directory
/path/to/persistent has proper permissions.
In the container an Apache2 is serving the contents, so make sure the user
33) is allowed to
rwx that directory.
To start with, you can use the original Specific directory from the Baïkal repository.
Then head to your Baikal instance (which will probably redirect to
BASEURL/admin/install), and setup your server.
Every configuration will be stored in the mounted volume at
To support encrypted connections you would need to mount the certificates as well as a modified Apache configuration into the container. However, I recommend to run it behind a reverse proxy, such as binfalse/nginx-proxy, and let the proxy handle all SSL connections (as for all other containers). This way, you just need one proper SSL configuration.
The default SQLite database is perfect for a first test, but is slow and just allows for a limited amount of SQL variables. If you for example have more than 999 contacts, the first sync of a clean WebDAV device will result in an exception such as:
PDOException: SQLSTATE[HY000]: General error: 1 too many SQL variables
Thus, for production you may want to switch to a proper database, such as MariaDB. Lucky you, the Docker image supports MySQL! ;-)
To reproducibly assemble both containers, I recommend Docker-Compose.
Here is a sample config with two containers
This assumes, that your Baikal configuration can be found in
The database will be stored in
Also note the database credentials for configuring Baikal.
If you’re not running a reverse proxy in front of the application, you also need to add some port forwarding for the
PLEASE NOTE: sSMTP is not maintained anymore! Please switch to
msmtp, for example, as I explained in Migrating from sSMTP to msmtp.
- apache (15) ,
- cloud (3) ,
- config (21) ,
- php (8) ,
- docker (16) ,
- webdav (1) ,
- http (6) ,
- mail (11) ,
- network (78) ,
- private (30) ,
- sync (4) ,
- ssmtp (5)