-
-
Save hdemon/8578805 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
docker build -t mysql . |
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
FROM ubuntu | |
RUN dpkg-divert --local --rename --add /sbin/initctl | |
RUN ln -s /bin/true /sbin/initctl | |
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get upgrade -y | |
RUN apt-get -y install mysql-client mysql-server | |
RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf | |
ADD ./startup.sh /opt/startup.sh | |
EXPOSE 3306 | |
CMD ["/bin/bash", "/opt/startup.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
#!/bin/sh | |
TAG="mysql" | |
CONTAINER_ID=$(docker ps | grep $TAG | awk '{print $1}') | |
IP=$(docker inspect $CONTAINER_ID | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[0]["NetworkSettings"]["IPAddress"]') | |
mysql -u admin -p -h $IP |
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
#!/bin/sh | |
docker run -d -p 3306:3306 -v /data/mysql:/var/lib/mysql mysql |
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
#/bin/bash | |
if [ ! -f /var/lib/mysql/ibdata1 ]; then | |
mysql_install_db | |
/usr/bin/mysqld_safe & | |
sleep 10s | |
echo "GRANT ALL ON *.* TO admin@'%' IDENTIFIED BY 'changeme' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql | |
killall mysqld | |
sleep 10s | |
fi | |
/usr/bin/mysqld_safe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment