Dockerize Sakai LMS v20.1

abc101
2 min readNov 4, 2020

Dockerize Sakai LMS and use it with linked MariaDB container

Previously, I created a Sakai LMS Vagrant box, because I wanted to make all in one Sakai system include a database server. It works fine and easy to use. After this, I needed to use the Sakai LMS with Docker.

Frankly speaking, I don’t need to include Sakai LMS binary in the Docker image because docker is very flexible to mapping among an outside volume and an inside volume.

I can use OpenJDK+Tomcat docker image. I just need to map from Sakai volume to Tomcat volume of container.

However, I built an image include Sakai LMS v20.1 binary.

How to use:

To use this Sakai LMS docker image, you need MariaDB server. I am using my MariaDB docker image instead of the official MariaDB image. The official MariaDB used Ubuntu for its base system, but I’d like to use Debian slim because it is smaller than Ubuntu. Run the MariaDB:

$ docker run --name mariadb -v \
/Users/abc101/docker-data/mariadb:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=password -p 3306:3306 \
-d abc101/mariadb:10.5-buster \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_unicode_ci
$ docker ps

I set default ENVs like,

DATABASE_SERVER db
DATABASE sakai
DATABASE_USER sakai
DATABASE_PASSWORD sakai201

You need to create database with the ENVs like,

$ docker exec -it mariadb bash$ mysql -urootmysql> create database sakai  default character set utf8;
create database sakai default character set utf8;
mysql> grant all on sakai.* to sakai@'localhost' identified by 'sakai201';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on sakai.* to sakaiuser@'127.0.0.1' identified by 'sakaipassword';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye!
$ exit
$

When the database is ready for Sakai, run the Sakai LMS v20.1 container,

$ docker run --name sakai --link mariadb:db -p 8080:8080 \--it abc101/sakai:20.1

It will download the Sakai image if you did not pull it yet and will run the Sakai by “catalina.sh run” as the CMS. You can watch the log by

$ docker exec -it sakai bash
$ tail -f ${CATALIAN_HOME}/logs/catalina.out

If there is no error, it will create initial database tables. It will take a log time depends on your system performance. Sakai has huge database tables, so you may have errors to create tables. When you have “create table…” errors, stop the Sakai container and start again. It will create rest of tables again.

$ docker stop sakai && docker start sakai

This is a demo image, so if you do not mapping the Sakai data volumes to outside volumes of container, then you will lost all data when you stop the Sakai container.

--

--