Comments (5)
[Dockerfile]
FROM ubuntu:16.04
MAINTAINER xxx<xxxx>
RUN groupadd --gid 1000 -r mysql && useradd --uid 1000 -r -g mysql mysql
RUN echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "mysql-server mysql-server/root_password password root" | debconf-set-selections \
&& echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections \
&& apt-get update \
&& apt-get -y install mysql-server-5.7 \
&& mkdir -p /var/lib/mysql \
&& mkdir -p /var/run/mysqld \
&& mkdir -p /var/log/mysql \
&& chown -R mysql:mysql /var/lib/mysql \
&& chown -R mysql:mysql /var/run/mysqld \
&& chown -R mysql:mysql /var/log/mysql
VOLUME /var/lib/mysql
COPY ./startup.sh /root/startup.sh
RUN chmod +x /root/startup.sh
ENTRYPOINT ["/root/startup.sh"]
EXPOSE 3306
CMD ["/usr/bin/mysqld_safe"]
[startup.sh]
#! /bin/bash
set -e
if [ ! -f /var/lib/mysql/ibdata1 ];then
MYSQL_ROOT_PWD=${MYSQL_ROOT_PWD:-"mysql"}
MYSQL_USER=${MYSQL_USER:-""}
MYSQL_USER_PWD=${MYSQL_USER_PWD:-""}
MYSQL_USER_DB=${MYSQL_USER_DB:-""}
mysqld --initialize-insecure --user=mysql
service mysql start $ sleep 10
echo "[i] Setting root new password."
mysql --user=root -e "UPDATE mysql.user set authentication_string=password('$MYSQL_ROOT_PWD') where user='root'; FLUSH PRIVILEGES;"
echo "[i] Setting root remote password."
mysql --user=root --password=$MYSQL_ROOT_PWD -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$MYSQL_ROOT_PWD' WITH GRANT OPTION; FLUSH PRIVILEGES;"
echo "[i] Setting up new power user credentials."
if [ -n "$MYSQL_USER_DB" ]; then
echo "[i] Creating datebase: $MYSQL_USER_DB"
mysql --user=root --password=$MYSQL_ROOT_PWD -e "CREATE DATABASE IF NOT EXISTS \`$MYSQL_USER_DB\` CHARACTER SET utf8 COLLATE utf8_general_ci; FLUSH PRIVILEGES;"
if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_USER_PWD" ]; then
echo "[i] Create new User: $MYSQL_USER with password $MYSQL_USER_PWD for new database $MYSQL_USER_DB."
mysql --user=root --password=$MYSQL_ROOT_PWD -e "GRANT ALL PRIVILEGES ON \`$MYSQL_USER_DB\`.* TO '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_USER_PWD' WITH GRANT OPTION; FLUSH PRIVILEGES;"
else
echo "[i] Don\`t need to create new User."
fi
else
if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_USER_PWD" ]; then
echo "[i] Create new User: $MYSQL_USER with password $MYSQL_USER_PWD for all database."
mysql --user=root --password=$MYSQL_ROOT_PWD -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_USER_PWD' WITH GRANT OPTION; FLUSH PRIVILEGES;"
else
echo "[i] Don\`t need to create new User."
fi
fi
killall mysqld
sleep 5
fi
echo "[i] Setting end,have fun."
exec "$@"
from ubuntu-mysql.
even if the issue description is pretty emtpy, I am having also the exact same behaviour. My docker container exists after a short period
from ubuntu-mysql.
Same here
from ubuntu-mysql.
Here as well
from ubuntu-mysql.
git clone https://github.com/Leafney/ubuntu-mysql.git;
cd ubuntu*;
git pull origin pull/3/head;
from ubuntu-mysql.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ubuntu-mysql.