Table of Contents
#Introduction
In this tutorial, How to Install MariaDB via docker. MariaDB is a popular open-source database server.
You need to install Docker on Ubuntu.
Install MariaDB via Docker
Download MariaDB Docker Image.
docker search mariadb
docker pull mariadb
Get a list of installed images on Docker.
docker images
Creating a MariaDB Container
We will create a MariaDB Container such as the flags below:
- –name my-mariadb: To set the name of the container. If nothing is specified a random if will be automatically generated.
- –env MYSQL_ROOT_PASSWORD=password_secret: Setting root password to Mariadb.
- –detach is to run the container in the background.
docker run --detach --name my-mariadb --env MARIADB_USER=example-user --env MARIADB_PASSWORD=example_user_password_secret --env MARIADB_ROOT_PASSWORD=password_secret mariadb:latest
Get the active docker container
docker ps
The container is running, How to access it?
docker exec -it my-mariadb mysql -uexample-user -p
Starting and Stopping MariaDB Container
restart MariaDB container
docker restart my-mariadb
stop MariaDB container
docker stop my-mariadb
start MariaDB container
docker start my-mariadb
In case we want to destroy a container,
docker rm -v my-mariadb
Conclusion
You Install MariaDB via Docker container. I hope this will be helpful. Thank you for reading the DevopsRoles page!