Building a Docker image for Mongo BI Connector


Mongo BI Connector is an awesome tool to use your Mongo DB storage as aBusiness Intelligence Cube. If you ran Mongo DB as Docker container maybe you asked how do you run Mongo BI Connector as a container also. Unfortunately there is almost nothing at Docker Hub to run this.

But nothing is lost. You can always build your own image. Here is a simple Dockerfile to achieve this requirement. You should use a mongosqld.conf in order to run Mongo BI Connector successfully.


FROM ubuntu:18.04
WORKDIR /home/mongobi
RUN apt-get update
RUN apt-get install -y libssl1.0.0 libssl-dev libgssapi-krb5-2 wget
RUN wget
RUN tar -xvzf mongodb-bi-linux-x86_64-ubuntu1804-v2.13.1.tgz
WORKDIR /home/mongobi/mongodb-bi-linux-x86_64-ubuntu1804-v2.13.1
RUN mkdir /logs
RUN ls
RUN echo $PATH
RUN install -m755 bin/mongo* /usr/local/bin/
CMD ["mongosqld", "--config=/home/mongobi/mongosqld.conf"]

The packages installed in apt-get command were determined as a trial-error process 😵.

Let’s define some variables, so you can replace with yours when needed:

{{YourLogFolder}}✅ = /home/johndoe/mongobi/logs
{{YourConfFolder}}✅ = /home/johndoe/mongobi/conf
{{YourDockerUser}}✅ = johndoe
{{YourSchemaPath}}✅ = /home/johndoe/mongobi/schema/schema.drdl # IF YOU HAVE, NOT REQUIRED 😋

Now build your image as:

docker build -t ✅{{YourDockerUser}}✅/mongobi .

To run this image first create a log folder, for example:

mkdir ✅{{YourLogFolder}}

And create a mongosqld.conf (for example):


path: '/logs/mongosqld.log'
verbosity: 10
uri: "mongodb://instance-1:27017,instance-2:27017/?replicaSet=MEDIUM"
# path: "✅{{YourSchemaPath}}✅" #If you have an schema please uncomment this line
port: 3307

Now, add our service to docker-compose.yml (if you have)


version: "3"
image: ✅{{YourDockerUser}}✅/mongobi
restart: always
#- "✅{{YourSchemaPath}}✅:/home/mongobi/schema.drdl" #Uncomment if you have an schema file
- "✅{{YourConfFolder}}✅/mongosqld.conf:/home/mongobi/mongosqld.conf"
- "✅{{YourLogFolder}}✅:/logs"
container_name: "mongo-bi"
hostname: "mongo-bi"
- "3307:3307"

Let’s run our container (using our docker-compose.yml path):

docker-compose up -d

Test if your container is running:

tail -f -n 25 ✅{{YourLogFolder}}✅/mongosqld.log

The output should be similar to:

2019-12-16T18:14:16.404+0000 I CONTROL    [initandlisten] mongosqld starting: version=v2.13.1 pid=1 host=mongo-bi
2019-12-16T18:14:16.404+0000 I CONTROL [initandlisten] git version: bae9ae2a9bff80642215b648d46312804fe62f2d
2019-12-16T18:14:16.404+0000 I CONTROL [initandlisten] OpenSSL version OpenSSL 1.1.1 11 Sep 2018 (built with OpenSSL 1.1.1 11 Sep 2018)
2019-12-16T18:14:16.404+0000 I CONTROL [initandlisten] options: {config: "/home/mongobi/mongosqld.conf", systemLog: {path: "/logs/mongosqld.log", verbosity: 10}, schema: {path: "/home/mongobi/schema.drdl"}, net: {bindIp: []}, mongodb: {net: {uri: "mongodb://instance-0:27017,instance-1:27017/?replicaSet=NeROUTE", auth: {source: "admin"}}}}
2019-12-16T18:14:16.404+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for mongosqld.
2019-12-16T18:14:16.404+0000 I CONTROL [initandlisten]
2019-12-16T18:14:16.413+0000 I NETWORK [initandlisten] waiting for connections at [::]:3307
2019-12-16T18:14:16.413+0000 I NETWORK [initandlisten] waiting for connections at /tmp/mysql.sock

And voilà, it is running as a container. 🤩

You can find this image in Docker Hub: docker pull juky/mongobi

Passionated developer

Passionated developer