mirror of
https://github.com/bitnami/containers.git
synced 2026-10-17 15:38:59 +02:00
Add log file support to mariadb
This commit is contained in:
@@ -8,16 +8,18 @@ RUN apt-get update -q && DEBIAN_FRONTEND=noninteractive apt-get install -qy wget
|
||||
/opt/bitnami/mysql/scripts/ctl.sh stop mysql > /dev/null && \
|
||||
echo "bin/mysql -S /opt/bitnami/mysql/tmp/mysql.sock -u root -p\$2 -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '\$2' WITH GRANT OPTION;\"" >> /opt/bitnami/mysql/scripts/myscript.sh && \
|
||||
rm -rf /tmp/* /opt/bitnami/mysql/data /opt/bitnami/ctlscript.sh && \
|
||||
mkdir /opt/bitnami/mysql/logs && ln -s /dev/stdout /opt/bitnami/mysql/logs/mysqld.log && \
|
||||
mkdir /opt/bitnami/mysql/conf.defaults && \
|
||||
mv /opt/bitnami/mysql/my.cnf /opt/bitnami/mysql/conf.defaults/ && \
|
||||
ln -s /opt/bitnami/mysql/conf/my.cnf /opt/bitnami/mysql/my.cnf && \
|
||||
ln -s /opt/bitnami/mysql/conf /conf && \
|
||||
ln -s /opt/bitnami/mysql/data /data && \
|
||||
ln -s /opt/bitnami/mysql/logs /logs && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get --purge autoremove -qy wget && apt-get clean && rm -rf /var/lib/apt && rm -rf /var/cache/apt/archives/*
|
||||
|
||||
ENV PATH /opt/bitnami/mysql/bin:$PATH
|
||||
EXPOSE 3306
|
||||
VOLUME ["/data", "/conf"]
|
||||
VOLUME ["/data", "/conf", "/logs"]
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
@@ -21,7 +21,8 @@ docker run --link mysql-server:mysql bitnami/mariadb \
|
||||
|
||||
Map a volume on your host to `/data` to persist your database when the container is removed.
|
||||
|
||||
If the volume is empty, the database will be initialized in your volume.
|
||||
If the volume is empty, the database will be initialized in your volume and the root password will
|
||||
be printed to stdout.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -50,3 +51,5 @@ The container is set up to log to stdout, which means logs can be obtained as fo
|
||||
```
|
||||
docker logs mysql-server
|
||||
```
|
||||
|
||||
If you would like to log to a file instead, you can mount a volume at `/logs`.
|
||||
|
||||
@@ -8,7 +8,7 @@ fi
|
||||
|
||||
|
||||
if [ "$1" = 'mysqld.bin' ]; then
|
||||
set -- "$@" --defaults-file=/opt/bitnami/mysql/my.cnf --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data --plugin-dir=/opt/bitnami/mysql/lib/plugin --user=mysql --socket=/opt/bitnami/mysql/tmp/mysql.sock$EXTRA_OPTIONS
|
||||
set -- "$@" --defaults-file=/opt/bitnami/mysql/my.cnf --log-error=/opt/bitnami/mysql/logs/mysqld.log --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data --plugin-dir=/opt/bitnami/mysql/lib/plugin --user=mysql --socket=/opt/bitnami/mysql/tmp/mysql.sock$EXTRA_OPTIONS
|
||||
|
||||
if [ ! "$(ls -A /conf)" ]; then
|
||||
echo "Copying default configuration to /conf/my.cnf..."
|
||||
@@ -34,6 +34,8 @@ if [ "$1" = 'mysqld.bin' ]; then
|
||||
su mysql -c "sh /opt/bitnami/mysql/scripts/myscript.sh /opt/bitnami/mysql $MYSQL_PASSWORD"
|
||||
/opt/bitnami/mysql/scripts/ctl.sh stop mysql > /dev/null
|
||||
fi
|
||||
|
||||
chown mysql:mysql -R /opt/bitnami/mysql/logs
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
||||
Reference in New Issue
Block a user