Docker is a popular lightweight virtualization engine used to run a wide range of applications. With Docker you get an environment where you can isolate different versions of operating systems and settings in fully controlled containers.
Mimer SQL is now available as a Docker image based on Ubuntu Linux on Docker Hub, providing for a simple and controlled deployment.
Starting the Mimer SQL container
To start using Mimer SQL in Docker all you have to do is to install Docker and then start the Mimer SQL container, which will be automatically downloaded.
To start the Mimer SQL container, run:
docker run -p 1360:1360 mimersql/mimersql_v11.0:latest
You can also use a specific tag, for example the V11.0.5A release:
docker run -p 1360:1360 mimersql/mimersql_v11.0:v11.0.5a
This launches a Mimer SQL database server that will be accessible on port 1360, the standard TCP port for Mimer SQL.
The default name of the created database is “mimerdb”. It can be customized using the option:
If no database administrator password is provided, a password will be generated and printed. Remember this password, it cannot be recovered. Such a SYSADM password can be predefined by specifying it using the option:
A Mimer SQL license can be specified using the option:
-e MIMER_KEY=<HEX key value>
If a persistent storage is used the Mimer SQL license is saved in the Mimer data directory, MIMER_DATA_DIR (see “Saving data between containers” below), for future use, i.e when the container is started again. This mean you only have to specify the license the first time you start the container when persistent storage is used. An alternative way is to copy your Mimer SQL license file directly to MIMER_DATA_DIR/my_mimerkey.mcfg.
Configuration of the Mimer SQL database
By utilizing Docker environment variables, as shown using the -e option above, it is possible to configure the Mimer SQL database server. For example it can be configured how much memory it will use and which TCP port the database server should listen at. As an example, to configure the TCP Port use the following option when starting the container:
The following environment variables can be used to configure the database server, given with the corresponding item in the Mimer SQL multidefs configuration file. For details, see the description of the multidefs file in the System Management Handbook part of the Mimer SQL Documentation Set (found in the Documentation page).
MIMER_TCP_PORT TCPPort MIMER_MAX_DBFILES Databanks MIMER_MAX_USERS Users MIMER_MAX_TABLES Tables MIMER_MAX_TRANS ActTrans MIMER_PAGES_4K Pages4K MIMER_PAGES_32K Pages32K MIMER_PAGES_32K Pages128K MIMER_REQUEST_THREADS RequestThreads MIMER_BACKGROUND_THREADS BackgroundThreads MIMER_TC_FLUSH_THREADS TcFlushThreads MIMER_BG_PRIORITY BackgroundPriority MIMER_INIT_SQLPOOL SQLPool MIMER_MAX_SQLPOOL MaxSQLPool MIMER_DELAYED_COMMIT DelayedCommit MIMER_DELAYED_COMMIT_TIMEOUT DelayedCommitTimeout MIMER_GROUP_COMMIT_TIMEOUT GroupCommitTimeout MIMER_NETWORK_ENCRYPTION NetworkEncryption
Connecting to the database
The Mimer SQL database server can be accessed using for instance DbVisualizer (https://www.dbvis.com) which comes with a JDBC driver and support for Mimer SQL. With the example above, using the host “localhost” and the port 1360, the JDBC connection string would be as follows, with an succeeding SYSADM login:
To be able to connect to Mimer SQL in the Docker container using the standard Mimer SQL tools, you have to register the database on the client, or host, computer. Register the database in the SQLHOSTS file, for example the /etc/sqlhosts file on linux (or with the Mimer Administrator on Windows). Simply specify the hostname to the machine that is running the Docker container and possibly the port number, for example:
-- Database Node Protocol Interface Service -- ------------------ ------------------ -------- --------- -------------------- mimerdb localhost '' '' 1360
Saving data between containers
Since the container is a separate entity the Docker container will lose all data when it is killed. This is quite convenient for testing, but not for production systems.
There are several solutions to save the data between sessions, but the easiest one is to use “bind mounts” where a directory on the host system is bound to the container’s MIMER_DATA_DIR setting, thus causing all file writes to persistently happen in the host file system.
An alternative solution is to use Docker volumes. This way the storage is managed by Docker. Just as with bind mounts the MIMER_DATA_DIR setting is mapped to the volume.
The default MIMER_DATA_DIR in the container is /data. This can be changed with the environment variable MIMER_DATA_DIR using the -e option.
Everything, including the database, license files and configurations, is stored in the database home directory, by default /data/mimerdb.
Using bind mounts
To use bind mounts, create a directory on the host that will act as the MIMER_DATA_DIR. When the directory is created, mount it when starting the container:
docker run -v /my_data:/data -p 1360:1360 -d mimersql/mimersql_v11.0:latest
The Mimer SQL database and it’s configuration will now be stored in /my_data/mimerdb on the host.
Using Docker volumes
To use Docker volumes, create the volume using docker volume create, for example:
docker volume create mimer_data
When starting the container, map the volume to the container:
docker run -v mimer_data:/data -p 1360:1360 -d mimersql/mimersql_v11.0:latest
docker run --mount source=mimer_data, target=/data -p 1360:1360 -d mimersql/mimersql_v11.0:latest
The Mimer SQL database and its configuration will now be stored in the Docker volume.