-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
70 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,18 @@ | ||
FROM centos:7 | ||
MAINTAINER Marcin Ryzycki [email protected], Przemyslaw Ozgo [email protected] | ||
FROM alpine:latest | ||
|
||
# Set TERM env to avoid mysql client error message "TERM environment variable not set" when running from inside the container | ||
ENV TERM=xterm \ | ||
MARIADB_VERSION=10.2 | ||
|
||
# Copy only files required for the following RUN commands (leverage Docker caching) | ||
COPY container-files / | ||
MARIADB_VERSION=10.1 | ||
|
||
RUN \ | ||
sed -i "s#MARIADB_VERSION#"${MARIADB_VERSION}"#g" /etc/yum.repos.d/mariadb.repo && \ | ||
yum update -y && \ | ||
yum install -y epel-release && \ | ||
yum install -y MariaDB-server hostname net-tools pwgen && \ | ||
yum clean all && \ | ||
rm -rf /var/lib/mysql/* && \ | ||
|
||
`# Install mysqltuner.pl` \ | ||
apk --no-cache add mariadb~${MARIADB_VERSION} mariadb-client net-tools pwgen curl bash; \ | ||
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*; \ | ||
rm -rf /var/lib/mysql/* /etc/mysql/; \ | ||
curl -sSL http://mysqltuner.pl/ -o mysqltuner.pl | ||
|
||
# Copy only files required for the following RUN commands (leverage Docker caching) | ||
COPY container-files / | ||
|
||
EXPOSE 3306 | ||
|
||
CMD ["/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
# MariaDB 10 Docker Image (Centos7) | ||
# MariaDB 10 Docker Image (Alpine ~100Mb) | ||
[![CircleCI Build Status](https://img.shields.io/circleci/project/million12/docker-mariadb/master.svg)](https://circleci.com/gh/million12/docker-mariadb/tree/master) | ||
[![GitHub Open Issues](https://img.shields.io/github/issues/million12/docker-mariadb.svg)](https://github.com/million12/docker-mariadb/issues) | ||
[![GitHub Stars](https://img.shields.io/github/stars/million12/docker-mariadb.svg)](https://github.com/million12/docker-mariadb) | ||
[![GitHub Forks](https://img.shields.io/github/forks/million12/docker-mariadb.svg)](https://github.com/million12/docker-mariadb) | ||
[![Stars on Docker Hub](https://img.shields.io/docker/stars/million12/mariadb.svg)](https://hub.docker.com/r/million12/mariadb) | ||
[![Pulls on Docker Hub](https://img.shields.io/docker/pulls/million12/mariadb.svg)](https://hub.docker.com/r/million12/mariadb) | ||
[![](https://images.microbadger.com/badges/version/million12/mariadb.svg)](http://microbadger.com/images/million12/mariadb) | ||
[![](https://images.microbadger.com/badges/license/million12/mariadb.svg)](http://microbadger.com/images/million12/mariadb) | ||
[![](https://images.microbadger.com/badges/image/million12/mariadb.svg)](http://microbadger.com/images/million12/mariadb) | ||
[![GitHub Open Issues](https://img.shields.io/github/issues/million12/docker-mariadb.svg)](https://github.com/million12/docker-mariadb/issues) | ||
[![Stars](https://img.shields.io/github/stars/million12/docker-mariadb.svg?style=social&label=Stars)]() | ||
[![Fork](https://img.shields.io/github/forks/million12/docker-mariadb.svg?style=social&label=Fork)]() | ||
[![](https://img.shields.io/github/release/million12/docker-mariadb.svg)](http://microbadger.com/images/million12/mariadb) | ||
[![Docker build](http://dockeri.co/image/million12/mariadb)](https://hub.docker.com/r/million12/mariadb/) | ||
|
||
Felling like supporting me in my projects use donate button. Thank You! | ||
[![](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.me/POzgo) | ||
|
||
This is a MariaDB 10 Docker [million12/mariadb](https://registry.hub.docker.com/u/million12/mariadb/) image. Built on top of official [centos:7](https://registry.hub.docker.com/_/centos/) image. Inspired by [Tutum](https://github.com/tutumcloud)'s [tutum/mariadb](https://github.com/tutumcloud/tutum-docker-mariadb) image. | ||
|
||
This is a MariaDB 10 in a Docker [million12/mariadb](https://registry.hub.docker.com/u/million12/mariadb/). | ||
|
||
**IMPORTANT: Migarted to Alpine Linux which shrinked the image from 1024M to ~120Mb** | ||
|
||
Note: be aware that, by default in this container, MariaDB is configured to use ~1GB memory (innodb_buffer_pool_size in [tuning.cnf](container-files/etc/my.cnf.d/tuning.cnf)). If you try to run it on node with less memory, it will fail. | ||
|
||
|
@@ -19,17 +21,26 @@ Please use tags on Docker Hub for different versions. | |
## Usage | ||
|
||
Run the image as daemon and bind it to port 3306: | ||
`docker run -d -p 3306:3306 million12/mariadb` | ||
|
||
```bash | ||
docker run -d \ | ||
-p 3306:3306 \ | ||
million12/mariadb | ||
``` | ||
|
||
Run the image as daemon and specify MariaDB version 10.2: | ||
`docker run -d million12/mariadb:10.2` | ||
|
||
```bash | ||
docker run -d \ | ||
million12/mariadb:10.1 | ||
``` | ||
|
||
The first time that you run your container, a new user admin with all privileges will be created in MariaDB with a random password. To get the password, check the logs of the container by running: | ||
`docker logs <CONTAINER_ID>` | ||
|
||
You will see an output like the following: | ||
|
||
``` | ||
```bash | ||
======================================================================== | ||
You can now connect to this MariaDB Server using: | ||
|
||
|
@@ -44,14 +55,19 @@ In this case, `CoFlnc3ZBS58` is the password assigned to the `admin` user. | |
### Custom Password for user admin | ||
If you want to use a preset password instead of a random generated one, you can set the environment variable MARIADB_PASS to your specific password when running the container: | ||
|
||
`docker run -d -p 3306:3306 -e MARIADB_PASS="mypass" million12/mariadb` | ||
```bash | ||
docker run -d \ | ||
-p 3306:3306 \ | ||
-e MARIADB_PASS="mypass" \ | ||
million12/mariadb | ||
``` | ||
|
||
### Data volumes | ||
|
||
MariaDB stores data in `/var/lib/mysql` location. Mount a volume | ||
to that location - below is an example with docker-compose how to do that: | ||
to that location - below is an example with `docker-compose` how to do that: | ||
|
||
``` | ||
```yaml | ||
version: '2' | ||
|
||
volumes: | ||
|
@@ -64,12 +80,9 @@ services: | |
- dbdata:/var/lib/mysql | ||
``` | ||
--- | ||
## Authors | ||
Author: Marcin Ryzycki (<[email protected]>) | ||
Author: Przemyslaw Ozgo (<[email protected]>) | ||
|
||
--- | ||
|
||
**Sponsored by [Prototype Brewery](http://prototypebrewery.io/)** - the new prototyping tool for building highly-interactive prototypes of your website or web app. Built on top of [Neos CMS](https://www.neos.io/) and [Zurb Foundation](http://foundation.zurb.com/) framework. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# This group is read both both by the client and the server | ||
# use it for options that affect everything | ||
# | ||
[client-server] | ||
|
||
# | ||
# include all files from the config directory | ||
# | ||
!include /etc/my.cnf.d/charset.cnf | ||
!include /etc/my.cnf.d/engine.cnf | ||
!include /etc/my.cnf.d/logging.cnf | ||
!include /etc/my.cnf.d/networking.cnf | ||
!include /etc/my.cnf.d/security.cnf | ||
!include /etc/my.cnf.d/slowlog.cnf | ||
!include /etc/my.cnf.d/tuning.cnf |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters