Docker is a well-known software platform that allows developers to seamlessly create, deploy and run applications as containers. Docker offers numerous other benefits, such as its robust encapsulation, isolation, portability, and control of containers which are usually very small in size. This is why Docker is used by a wide variety of developers across the world.
This article will help you understand how you can set up MariaDB Docker deployment using the official MariaDB images for Docker.
Table of Contents
What is MariaDB?
Image Source
MariaDB is a popular Open-source Relational Database Management System (RDBMS). It was developed as a software fork of another popular Open-source database, MySQL, by the developers who played key roles in developing the original database. MariaDB was devised in 2009 when MySQL was acquired by Oracle. It was designed to ensure ease of use, speed, and reliability for all its users.
Like all other Relational Database Management Systems (RDBMS), MariaDB houses support for ACID-Compliant Data Processing. Along with that, it also supports parallel Data Replication, JSON APIs, and multiple storage engines, including InnoDB, Spider, MyRocks, Aria, Cassandra, TokuDB, and MariaDB ColumnStore.
It is very easy to deploy MariaDB in operational agility without compromising its key enterprise features that consist of real ACID compliance and full SQL. Still, the developers are continuously working to enhance the MariaDB experience for its users. Its well-versed users are Deutsche Bank, DBS Bank, NASDAQ, Red Hat, ServiceNow, Verizon, and Walgreens industry champions who trust MariaDB for their unmatched delivery of agile operations that provides a reliable enterprise to drive collaborative innovation.
More information on MariaDB can be found here.
What is Docker?
Image Source
Docker is a service provider tool for OS-level products to create and deploy software via containers as a complete package. These Docker containers work separately through their built-in software, libraries, and configuration files. Although they work in isolation, they can communicate with each other via a significant path. The components of Docker are as follows:
1) Docker Container
A complete package of OS services that works as a Virtual Machine to allow the application to use the same Linux kernel as that of the OS of the running machine. In this way, it reduces the size of apps that enhance the performance of the machine significantly.
2) Docker File
A DockerFile is a script used to generate a Docker Image where you can independently manage any generated change that you want to deploy via using MariaDB.
3) Docker Image
As Docker works as a Virtual Machine, so Image is a template of that virtual machine. An image in a Docker file is a complete package that could be used by the operating system, software packages, drivers, configuration files, and helper in a script bundle. Images are easy to build by any person who is well versed in writing an Image script for Docker. So, the script of an Image can vary from writer to writer but the purpose of an Image remains consistent in all varieties of Images.
More information on Docker can be found here.
Hevo is a No-code Data Pipeline that offers a fully-managed solution to set up data integration from 100+ data sources (30+ free data sources) including MariaDB and will let you directly load data to a Data Warehouse or the destination of your choice. It will automate your data flow in minutes without writing any line of code.
Get Started with Hevo for Free
Its fault-tolerant architecture makes sure that your data is secure and consistent. Hevo provides you with a truly efficient and fully-automated solution to manage data in real-time and always have analysis-ready data.
Let’s Look at Some Salient Features of Hevo:
- Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
- Schema Management: Hevo takes away the tedious task of schema management & automatically detects schema of incoming data and maps it to the destination schema.
- Minimal Learning: Hevo, with its simple and interactive UI, is extremely simple for new customers to work on and perform operations.
- Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
- Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
- Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
- Live Monitoring: Hevo allows you to monitor the data flow and check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!
Steps to Set up MariaDB Docker Deployment
Users can set up MariaDB Docker deployment by implementing the following steps:
MariaDB Docker Deployment Step 1: Installing Docker using Universal Installation Script
Running the following script will get all the necessary Docker repositories installed including packaging and Kernel modules on your Linux distributions:
curl -sSL https://get.docker.com/ | sh
MariaDB Docker Deployment Step 2: Starting the Docker Daemon
The Docker daemon, Dockerd can be started by running the following commands:
sudo systemctl start docker
sudo gpasswd -a "${USER}" docker
MariaDB Docker Deployment Step 3: Using MariaDB Docker Image
The best way to deploy MariaDB on Docker is to choose a MariaDB Docker image and create a container using it. This can be done by implementing the following steps:
- Downloading the Image: MariaDB image for the Docker can be downloaded from MariaDB’s official documentation for Docker. The following command can be used to search for MariaDB Docker images:
docker search mariadb
To install the default MariaDB Docker image, the following command can be executed:
docker pull mariadb:10.x
A list of installed images can be obtained using the following command:
docker images
- Creating a Container: An image is just the software needed to be launched. To run it, a container needed to be created first. The command to create a container for the official MariaDB Docker Image is as follows:
docker run --name mariadbprac -e MYSQL_ROOT_PASSWORD=pass -p 3308:3308 -d docker.io/library/mariadb:10.x
The above command gives the name mariadbprac to the container. Now, the following command has to be executed:
docker run --name mariadbprac -e MYSQL_ROOT_PASSWORD=pass -p 3308:3308 -d docker.io/library/mariadb:10.x
Docker will respond with the Container’s ID. You can get the list of Containers by the following command:
docker ps
- Running & Stopping Container: To start the MariaDB Docker Container, the following command can be executed:
docker restart mariadbprac
To stop the MariaDB Docker Container, the following command can be executed:
docker stop mariadbprac
- Accessing the Container: The Container can be accessed using bash by using the following command:
docker exec -it mariadb_prac_test bash
- Connecting MariaDB from Outside the Container: Connections to the MariaDB Server are made using TCP when the Client is running on the same machine as the Server Container. The following command is used to find the IP address of the assigned Container:
Docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadprac
Now, you can connect to the MariaDB Server using a TCP connection to that IP address. The TCP Connection can be forced using the following command:
mysql -h 172.17.0.2 -u root -p
Sometimes, you need to specify the port for the Server or to force TCP mode:
mysql -h 173.18.0.2 -P 3308 --protocol=TCP -u root -p
This completes the deployment of MariaDB Docker and accessing the Container.
Conclusion
Docker is a very powerful tool for deploying applications since it creates a very robust and scalable deployment environment for both production and non-production services. It uses the concept of containerization to make processes simple and scalable. This article provided you with an in-depth understanding of how you can set up MariaDB Docker deployment using the default images.
Visit our Website to Explore Hevo
Most businesses today use multiple platforms to carry out their day-to-day operations. As a result, all their data is spread across the databases of these platforms. If a business wishes to perform a common analysis of their data, they would first have to integrate the data from all these databases and store it in a centralized location. Building an in-house data integration solution would be a complex task that would require a high volume of resources. Businesses can instead use existing automated No-code data integration platforms like Hevo.
Hevo helps you directly transfer data from a source of your choice to a Data Warehouse, Business Intelligence, or desired destination in a fully automated and secure manner without having to write the code. It will make your life easier and make data migration hassle-free. It is User-Friendly, Reliable, and Secure.
Details on Hevo’s pricing can be found here. Want to take Hevo for a spin? Sign Up here for a 14-day free trial and experience the feature-rich Hevo suite first hand.
In his role as a freelance writer, Muhammad loves to use his analytical mindset and a problem-solving ability to help businesses solve problems by offering extensively researched content.