Would you like to learn how to install MariaDB using Docker on Ubuntu Linux? In this tutorial, we are going to show you all the steps required to perform the MariaDB installation using Docker on a computer running Ubuntu Linux in 5 minutes or less.
• Ubuntu 20.04
• Ubuntu 18.04
• MariaDB 10.5.5
Tutorial MariaDB – Docker Installation on Ubuntu Linux
Install the Docker service.
Download the MariaDB docker image from the online repository.
List the Docker images installed on your system.
Here is the command output:
Start a new MariaDB container using this Docker image.
Here is the command output:
In our example, the Docker image was used to start a new container.
The new container is using the local port 3306.
The container ID is 118d362dc3f7b1eebf270e4c9b64f0a2e53642ddbe2a2e661a4cc6d1f54aa026.
The MariaDB password configured was kamisama123.
Congratulations! You have finished the MariaDB Docker installation on Ubuntu Linux.
Docker MariaDB – Persistent data
Create the required directory to store the MariaDB data.
Start a MariaDB container with persistent data storage.
In our example, the MariaDB password configured was kamisama123.
Verify the content of the persistent data directory.
Congratulations! You successfully configured the use of Docker persistent data storage.
Tutorial MariaDB – Testing the Docker installation
Install the MySQL client package on the localhost.
Access the MariaDB service running on the Docker container.
Here is the command output:
Congratulations! Your MariaDB Docker installation was tested successfully.
Tutorial MariaDB – Docker container management
Verify the status of all Docker conteiners using the following command:
Here is the command output:
Verify the status of the MariaDB container using the ID or its name.
Here is the command output:
To stop the MariaDB container service, use the following command:
To start the MariaDB container service, use the following command:
To restart the MariaDB container service, use the following command:
In case of error, use the following command to verify the MariaDB container logs.
In our examples, we demonstrated how to manage the MariaDB container using its ID or the name previously defined.