Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/instazdll/simple-mariadb-docker

A Mariadb handmade docker container.
https://github.com/instazdll/simple-mariadb-docker

docker docker-container dockerfile mariadb mariadb-server

Last synced: 27 days ago
JSON representation

A Mariadb handmade docker container.

Awesome Lists containing this project

README

        

# 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](https://img.shields.io/github/v/release/InstaZDLL/simple-mariadb-docker?style=for-the-badge)](https://img.shields.io/github/v/release/InstaZDLL/simple-mariadb-docker?sort=date&display_name=release&style=for-the-badge
) ![GitHub License](https://img.shields.io/github/license/InstaZDLL/simple-mariadb-docker?style=for-the-badge) ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/InstaZDLL/simple-mariadb-docker?style=for-the-badge) ![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/InstaZDLL/simple-mariadb-docker/total?style=for-the-badge&color=%230080ff)

## 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](https://github.com/InstaZDLL/simple-mariadb-docker/blob/main/.github/mysqld-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:

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

## Author

- [@InstaZDLL](https://github.com/InstaZDLL)

## License

```text
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.
```
[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)

[dill]:
[git-repo-url]:
[john gruber]:
[df1]:
[markdown-it]:
[Ace Editor]:
[node.js]:
[Twitter Bootstrap]:
[jQuery]:
[@tjholowaychuk]:
[express]:
[AngularJS]:
[Gulp]:

[PlDb]:
[PlGh]:
[PlGd]:
[PlOd]:
[PlMe]:
[PlGa]: