Created
May 29, 2015 06:32
-
-
Save pdxjohnny/5b5f3b528c7024adebd4 to your computer and use it in GitHub Desktop.
Docker mysql scripts
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
mysql: | |
image: mysql:latest | |
ports: | |
- "13306:3306" | |
environment: | |
- MYSQL_ROOT_PASSWORD=root | |
volumes: | |
- /srv/docker/mysql:/var/lib/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/sh | |
# /etc/init.d/docker-mysql | |
# | |
case "$1" in | |
start) | |
echo "Starting docker mysql..." | |
docker start mysql_mysql_1 | |
;; | |
stop) | |
echo "Stoping docker mysql..." | |
docker stop mysql_mysql_1 | |
;; | |
*) | |
echo "Usage: sudo service docker-mysql {start|stop}" | |
exit 1 | |
;; | |
esac | |
exit 0 | |
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 | |
# Run as root | |
NAME="docker-mysql" | |
docker-compose up | |
cp ./${NAME} /etc/init.d/${NAME} | |
chmod 774 /etc/init.d/${NAME} | |
update-rc.d ${NAME} defaults 99 01 | |
# Connect with | |
# mysql -h 127.0.1.1 --port 13306 -u root -p | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment