Skip to content

Commit 0730a9d

Browse files
authored
Merge pull request #11 from linuxserver/xenial
Xenial rebase
2 parents de87eb0 + 2d0d2b6 commit 0730a9d

File tree

7 files changed

+82
-57
lines changed

7 files changed

+82
-57
lines changed

Dockerfile

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
1-
# set base os
2-
FROM linuxserver/baseimage
1+
FROM lsiobase/xenial
2+
MAINTAINER sparklyballs
33

4-
MAINTAINER Sparklyballs <[email protected]>
5-
6-
# set some environment variables for mariadb to give us our paths
7-
ENV INSTALL_LIST="mariadb-server mysqltuner"
4+
# environment variables
5+
ARG DEBIAN_FRONTEND="noninteractive"
86
ENV MYSQL_DIR="/config"
97
ENV DATADIR=$MYSQL_DIR/databases
108

11-
# set the repo version for mariadb choose between 5.5 or 10.0
12-
ENV REPO_VER 10.1
9+
# set version label
10+
ARG BUILD_DATE
11+
ARG VERSION
12+
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
1313

1414
# update apt and install packages
15-
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db && \
16-
echo "deb [arch=amd64,i386] http://lon1.mirrors.digitalocean.com/mariadb/repo/${REPO_VER}/ubuntu trusty main" >> /etc/apt/sources.list.d/mariadb.list && \
17-
apt-get update && \
18-
apt-get install \
19-
$INSTALL_LIST -qy && \
15+
RUN \
16+
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 && \
17+
echo "deb [arch=amd64,i386] http://mirrors.coreix.net/mariadb/repo/10.1/ubuntu xenial main" >> /etc/apt/sources.list.d/mariadb.list && \
18+
echo "deb-src http://mirrors.coreix.net/mariadb/repo/10.1/ubuntu xenial main" >> /etc/apt/sources.list.d/mariadb.list && \
19+
apt-get update && \
20+
apt-get install -y \
21+
mariadb-server && \
2022

2123
# cleanup
22-
apt-get clean -y && \
23-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/lib/mysql && \
24-
mkdir -p /var/lib/mysql
25-
26-
#Adding Custom files
27-
COPY defaults/ /defaults/
28-
COPY init/ /etc/my_init.d/
29-
COPY services/ /etc/service/
30-
RUN chmod -v +x /etc/service/*/run /etc/my_init.d/*.sh
31-
32-
# set volumes and ports
33-
VOLUME /config
24+
rm -rf \
25+
/tmp/* \
26+
/var/lib/apt/lists/* \
27+
/var/lib/mysql \
28+
/var/tmp/* && \
29+
mkdir -p \
30+
/var/lib/mysql
31+
32+
# add local files
33+
COPY root/ /
34+
35+
# ports and volumes
3436
EXPOSE 3306
35-
36-
37+
VOLUME /config

README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
![https://linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)
1+
[linuxserverurl]: https://linuxserver.io
2+
[forumurl]: https://forum.linuxserver.io
3+
[ircurl]: https://www.linuxserver.io/irc/
4+
[podcasturl]: https://www.linuxserver.io/podcast/
25

3-
The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring easy user mapping and community support. Find us for support at:
4-
* [forum.linuxserver.io](https://forum.linuxserver.io)
5-
* [IRC](https://www.linuxserver.io/irc/) on freenode at `#linuxserver.io`
6-
* [Podcast](https://www.linuxserver.io/podcast/) covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation!
6+
[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl]
7+
8+
The [LinuxServer.io][linuxserverurl] team brings you another container release featuring easy user mapping and community support. Find us for support at:
9+
* [forum.linuxserver.io][forumurl]
10+
* [IRC][ircurl] on freenode at `#linuxserver.io`
11+
* [Podcast][podcasturl] covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation!
712

813
# linuxserver/mariadb
14+
[![](https://images.microbadger.com/badges/version/linuxserver/mariadb.svg)](https://microbadger.com/images/linuxserver/mariadb "Get your own version badge on microbadger.com")[![](https://images.microbadger.com/badges/image/linuxserver/mariadb.svg)](http://microbadger.com/images/linuxserver/mariadb "Get your own image badge on microbadger.com")[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/mariadb.svg)][hub][![Docker Stars](https://img.shields.io/docker/stars/linuxserver/mariadb.svg)][hub][![Build Status](http://jenkins.linuxserver.io:8080/buildStatus/icon?job=Dockers/LinuxServer.io/linuxserver-mariadb)](http://jenkins.linuxserver.io:8080/job/Dockers/job/LinuxServer.io/job/linuxserver-mariadb/)
15+
[hub]: https://hub.docker.com/r/linuxserver/mariadb/
16+
17+
One of the most popular database servers. Made by the original developers of MySQL
918

10-
![](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/mariadb-git.png)
19+
[![mariadb](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/mariadb-git.png)][mariaurl]
20+
[mariaurl]: https://mariadb.org/
1121

1222
## Usage
1323

@@ -18,6 +28,7 @@ docker create \
1828
-e PUID=<UID> \
1929
-e PGID=<GID> \
2030
-e MYSQL_ROOT_PASSWORD=<DATABASE PASSWORD> \
31+
-e TZ=<timezone> \
2132
-v </path/to/appdata>:/config \
2233
linuxserver/mariadb
2334
```
@@ -29,6 +40,9 @@ linuxserver/mariadb
2940
* `-e MYSQL_ROOT_PASSWORD` - set this to root password for installation (minimum 4 characters)
3041
* `-e PGID` for GroupID - see below for explanation
3142
* `-e PUID` for UserID - see below for explanation
43+
* `-e TZ` - for timezone information *eg Europe/London, etc*
44+
45+
It is based on ubuntu xenial with s6 overlay, for shell access whilst the container is running do `docker exec -it mariadb /bin/bash`.
3246

3347
### User / Group Identifiers
3448

@@ -43,25 +57,25 @@ In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as bel
4357

4458
## Setting up the application
4559

46-
If you didn't set a password during installation, (see logs for warning) use mysqladmin -u root password <PASSWORD> to set one at the docker prompt... NOTE changing the MYSQL_ROOT_PASSWORD variable after the container has set up the initial databases has no effect. It is also advisable to edit the run command or template/webui after setup and remove reference to this variable.
47-
48-
Find custom.cnf in /config for config changes (restart container for them to take effect)
49-
, the databases in /config/databases and the log in /config/log/myqsl
60+
If you didn't set a password during installation, (see logs for warning) use mysqladmin -u root password <PASSWORD> to set one at the docker prompt...
5061

51-
The container also has mysqltuner included which can either be run from within the container by exec'ing in or externally by issuing `docker exec -it mariadb mysqltuner`. It will prompt for credentials if you have set a password for root user.
62+
NOTE changing the MYSQL_ROOT_PASSWORD variable after the container has set up the initial databases has no effect, use the mysqladmin tool to change your mariadb password.
5263

64+
Unraid users, it is advisable to edit the template/webui after setup and remove reference to this variable.
5365

66+
Find custom.cnf in /config for config changes (restart container for them to take effect)
67+
, the databases in /config/databases and the log in /config/log/myqsl
5468

55-
## Logs and Shell
69+
## Info
5670

5771
* Shell access whilst the container is running: `docker exec -it mariadb /bin/bash`
5872
* To monitor the logs of the container in realtime: `docker logs -f mariadb`
59-
60-
73+
* container version number `docker inspect -f '{{ index .Config.Labels "build_version" }}' mariadb`
74+
* image version number `docker inspect -f '{{ index .Config.Labels "build_version" }}' linuxserver/mariadb`
6175

6276
## Versions
63-
+ **09.03.2016:** Update to mariadb 10.1. Change to use custom.cnf over my.cnf in /config. Restructured init files to change config options on startup, rather than in the dockerfile.
64-
+ **26.01.2016:** Change user of mysqld_safe script to abc, better unclean shutdown handling on restart.
65-
+ **23.12.2015:** Remove autoupdating, between some version updates the container breaks
66-
+ **12.08.2015:** Initial Release.
67-
77+
+ **11.10.16:** Rebase to ubuntu xenial, add version labelling.
78+
+ **09.03.16:** Update to mariadb 10.1. Change to use custom.cnf over my.cnf in /config. Restructured init files to change config options on startup, rather than in the dockerfile.
79+
+ **26.01.16:** Change user of mysqld_safe script to abc, better unclean shutdown handling on restart.
80+
+ **23.12.15:** Remove autoupdating, between some version updates the container breaks
81+
+ **12.08.15:** Initial Release.
File renamed without changes.
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
#!/bin/bash
1+
#!/usr/bin/with-contenv bash
22

33
# make folders if required
4-
mkdir -p "$DATADIR" /var/run/mysqld /config/log/mysql
4+
mkdir -p \
5+
"$DATADIR" \
6+
/config/log/mysql \
7+
/var/run/mysqld
58

69
# configure my.cnf and mysqld_safe
710
sed -i 's/key_buffer\b/key_buffer_size/g' /etc/mysql/my.cnf
@@ -12,9 +15,15 @@ sed -i -e "s#\(datadir.*=\).*#\1 $DATADIR#g" /etc/mysql/my.cnf
1215
sed -i "s/user='mysql'/user='abc'/g" /usr/bin/mysqld_safe
1316

1417
# setup custom cnf file
15-
[[ ! -f /config/custom.cnf ]] && cp /defaults/my.cnf /config/custom.cnf
16-
[[ ! -L /etc/mysql/conf.d/custom.cnf && -f /etc/mysql/conf.d/custom.cnf ]] && rm /etc/mysql/conf.d/custom.cnf
17-
[[ ! -L /etc/mysql/conf.d/custom.cnf ]] && ln -s /config/custom.cnf /etc/mysql/conf.d/custom.cnf
18+
[[ ! -f /config/custom.cnf ]] && \
19+
cp /defaults/my.cnf /config/custom.cnf
20+
[[ ! -L /etc/mysql/conf.d/custom.cnf && -f /etc/mysql/conf.d/custom.cnf ]] && \
21+
rm /etc/mysql/conf.d/custom.cnf
22+
[[ ! -L /etc/mysql/conf.d/custom.cnf ]] && \
23+
ln -s /config/custom.cnf /etc/mysql/conf.d/custom.cnf
1824

1925
# set permissions
20-
chmod -R 777 /var/run/mysqld
26+
[[ -e /etc/mysql/debian.cnf ]] && \
27+
(chown abc:abc /etc/mysql/debian.cnf && chmod 644 /etc/mysql/debian.cnf)
28+
chmod -R 777 \
29+
/var/run/mysqld

init/40_set_up_dbase.sh renamed to root/etc/cont-init.d/40-initialise-db

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/bin/bash
1+
#!/usr/bin/with-contenv bash
2+
23
# set start function that creates user and password, used later
34
start_mysql(){
45
mysqld --init-file="$tempSqlFile" &
@@ -68,7 +69,7 @@ echo "Database Setup Completed"
6869

6970
# display a message about password if not set or too short
7071
if [ "$TEST_LEN" -lt "4" ]; then
71-
less /tmp/no-pass.nfo
72+
echo "$(cat /tmp/no-pass.nfo)"
7273
sleep 5s
7374
fi
7475

@@ -90,4 +91,3 @@ rm /tmp/mysql-first-time.sql
9091
fi
9192

9293
chown -R abc:abc /config
93-

root/etc/services.d/mariadb/run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/with-contenv bash
2+
exec \
3+
s6-setuidgid abc /usr/bin/mysqld_safe

services/mysql/run

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)