Skip to content

InstaZDLL/simple-mariadb-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Mariadb Docker

This repository contains a Dockerfile for building a MariaDB image based on Debian. The image is configured to run MariaDB as a non-root user for security reasons.

Info : The mariadb in the container is a pre-build image so the user, password and the database, are created by default for a wordpress.

GitHub Release GitHub License GitHub last commit (by committer) GitHub Downloads (all assets, all releases)

How It Works

The Dockerfile installs MariaDB and other necessary packages on a Debian base image. It also sets up necessary directories and permissions for running MariaDB.

The docker-entrypoint.sh script is used to initialize the database and create a user when the container is started. The script checks if it's being run as root, and if so, uses gosu to step down from root to the mysql user.

Environment variables are used to configure the database. You can set the root password, database name, username, and password using the MYSQL_ROOT_PASSWORD, MYSQL_DATABASE, MYSQL_USER, and MYSQL_PASSWORD environment variables, respectively.

Environment Variables

The following environment variables can be set when running the Docker container:

ENV Default value Example Description
MYSQL_ROOT_PASSWORD credentials.md myrootpassword By default, the root password is randomly generated. You can specify a specific root password if required.
MYSQL_DATABASE wordpress mydatabase The name of the first database.
MYSQL_USER wpuser myuser The username first user.
MYSQL_PASSWORD wpuser mypassword The password for the first user.

How to Run the Container

You can run a container from this image using the following command:

docker run -d --name some-mariadb -p 3306:3306 nayeonyny/mariadb:latest

Author

License

Copyright (C) 2024 Ethan Besson

Licensed under the Academic Free License version 3.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://opensource.org/license/afl-3-0-php/

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.