Commit 53d17780 authored by Waqas Riaz's avatar Waqas Riaz

Added README.md and Dockerfile for mariadb container images

parent abc52975
# Runnning Mariadb as docker
* After CLoning this repo, go to mariadb folder under databases.
* Run following command to build the docker image.
`docker build -t my-custom-db -f db.Dockerfile .`
* The build image can be seen in the docker images list with below command.
`docker image ls`
* Now create the docker container, also pass the necessary environment variables for initial settings. Following command is given as example.
`docker run -d --name my-custom-db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=YOUR_ROOT_PASSWORD -e MYSQL_DATABASE=Devops -e MYSQL_USER=admin -e MYSQL_PASSWORD=YOUR_USER_PASSWORD db1`
* MariaDB docker container is up and running.
\ No newline at end of file
# syntax=docker/dockerfile:1
FROM mariadb:focal
#Initialize and pre-populate the table from queries written in mytable.sql
COPY mytable.sql /docker-entrypoint-initdb.d/
#can be moved to docker run command and optionally docker-compose
VOLUME [ "/var/lib/mysql" ]
EXPOSE 3306
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment