Saturday, November 28, 2020

How To Deploy MariaDB on Docker Without Dockerfile On Ubuntu 20.04

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 MariaDB is an open source relational database management system (DBMS).

Docker is an open source virtualization and containerization technology for building and containerizing your applications. It's a tool that allows you to create isolated containers that can be used to run your apps.
Offcial Website -https://www.docker.com/

MariaDB Dockerhub link - https://hub.docker.com/_/mariadb
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Testing Environment:
Ubuntu 20.04 LTS                     Hostname - www.yourdomain.com  - ip Address - 192.168.1.10  
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


apt update ; apt install -y build-essential net-tools curl git software-properties-common neofetch apt-transport-https ca-certificates curl gnupg-agent docker.io docker-compose

systemctl enable --now docker ; docker --version ; docker-compose version
usermod -aG docker $USER ; newgrp docker

docker pull mariadb
docker run -d --name mariadb1 \
-p 33061:3306 \
-v ~/Docker/mariadb1/config:/etc/mysql/conf.d \
-v ~/Docker/mariadb1/datadir:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=root123 \
-e MYSQL_DATABASE=dbtest \
mariadb

docker ps
docker logs mariadb1
docker exec -it mariadb1 bash
mysql --user=root --password=root123
show databases;


Container-id -

Container-id -           $ docker ps -aq                         
Stop Container -         $ docker stop ed2896902b49                 
Start Container -        $ docker start ed2896902b49
Check Container logs-    $ docker logs ed2896902b49
Delete a Docker Image -  $ docker rmi ed2896902b49

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment