All In One Custom Mariadb MySQL For SQL Database Developer Docker Image

George Jen
4 min readDec 27, 2021

George Jen, Jen Tek LLC

For our purpose, we need a MariaDB (MySQL) instance. Therefore, we want a custom docker image that includes the following:

CentOS 8
MariaDB Server version: 10.3.28 (MySQL)
Python3 with mariadb python3 connector installed
Java Development Toolkit 1.8
Development Tools including C/C++ compiler and git etc.
Jupyter-notebook server to run Python from the host
ssh-server for the ease of connecting to the container using ssh and scp, as oppose using docker exec and docker cp

There are following OS users configured:

root (password root)
database (password 123456)
mysql (password not set, you can "su - mysql" from root)

Python3 libraries are installed under database user.

Based upon the above requirements, we have built the docker image, jentekllc/mariadb:latest.

Here is the docker image jentekllc/mariadb:latest and here is the tarball consisting support files including docker-compose.yml.

System Requirement.

It requires at least 4GB memory available to the docker daemon.
If using docker desktop with Mac and Windows, memory resource to docker defaults to 2GB. You need to set it to 4GB or more.

For Docker desktop with Mac, click docker icon on the top, then click Preferences in the dropdown list, then click Resources on the left, move the memory bar scale to 4GB or greater from 2GB default.

For Docker desktop with Windows, follow documentation on increasing memory capacity allocation to docker.

Load docker images.

Download the files from the links above or below:

mariadb.tgz (650.7MB)
mariadb_support_files.tar (8KB)

Create a folder and place the 2 downloaded files into the new folder. Change directory into the folder.

Run below command:

$ docker load < mariadb.tgz

It may take a while for the docker load to complete. Then run below command to confirm:

$  docker image lsREPOSITORY             TAG       IMAGE ID       CREATED          SIZE
jentekllc/mariadb latest fee607769a06 56 minutes ago 1.83GB

Expand the mariadb_support_files.tar by

tar -xf mariadb_support_files.tar

Following files and folders will be extracted:


Docker-compose.yml (please edit to change database root user password, it defaults to 123456)


data (Mariadb container file system /var/lib/mysql will mount the data folder on the host to persist the database)

Startup the Mariadb docker container.

To start, simply run:

$ docker-compose up -d

To confirm the container has been started, run below command:

$ docker psCONTAINER ID   IMAGE                      COMMAND                  CREATED          STATUS          PORTS                                                                                                                           NAMES
8c679126338b jentekllc/mariadb:latest "/start_mysqld_sshd.…" 16 minutes ago Up 16 minutes>3306/tcp, :::3306->3306/tcp,>8888/tcp, :::8888->8888/tcp,>22/tcp, :::10022->22/tcp mariadb-container

To stop, please run:

$ docker-compose stop

Note: Do NOT run “docker-compose down”

Container ports exposed to the host, as defined in docker-compose.yml.

ssh server port 22 is opened to the host as port 10022 because port 22 is used on the host.
Jupyter notebook server port 8888 is opened as port 8888 on the host.
Mariadb server port 3306 is opened as port 3306 on the host

Access examples from the host.

Jupyter notebook server can be accessed by:


You can ssh into the container by:

ssh -p 10022 root@localhost

Note: root password is root.

You can run native mysql client if you do not have it installed on the host.

# su - mysql$ mysql -u root -p
Note: mysql root password is 123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.3.28-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]>

GUI client on the host, MySQL Workbench.

While any JDBC client will work with Mariadb (MySQL), I prefer to use MySQL Workbench as it works natively using the same wiring protocol as character based mysql client. MySQL Workbench not only contains a SQL client, but also comes with reverse engineer feature to generate entity relationship diagram (ERD) from a schema.

MySQL Workbench version 8.0.27 requires SSL to connect to MySQL or Mariadb. It will not connect to the database unless SSL is configured. Without SSL being configured, workaround is to download MySQL Workbench version lower than 8.0.27.

If SSL is not configured, set field “Use SSL” to “if available” as shown.

Need a demo schema?

If need a demo database, search on Google “Northwind Mysql”, there are many available, below is one of them:

About us

We containerize open source projects. Our containers usually include the associated development environment with popular programming languages

We have created many docker images for various purposes. For details, please see:

All in one custom and comprehensive Docker Image for the data engineering developer on Apache Spark

All in one custom Docker Image for ETL pipeline/data preprocessing developer on Apache Airflow

All In One Custom Docker Image for Streaming/Real Time Data Preprocessing Developer on Apache Samza with Kafka

All In One Custom PostgreSQL For Database Developer Docker Image

All docker images referenced in this writing are for educational purpose only. There is no warranty on these docker images and their associated files.

You should change passwords for all services in all containers.

Thank you for reading.


I am a frequent content contributor here, you can subscribe my writings on data engineering and other computer science subjects.



George Jen

I am founder of Jen Tek LLC, a startup company in East Bay California developing AI powered, cloud based documentation/publishing software as a service.