From wangxian
a docker image base on alpine with mysql
docker build -t alpine-mysql:latest .
cp .env-dist .env
nano .env # change environment if you need
docker-compose build
docker run -it --name mysql -p 3306:3306 -v $(pwd):/app -e MYSQL_DATABASE=admin -e MYSQL_USER=tony -e MYSQL_PASSWORD=dpa\*12d -e MYSQL_ROOT_PASSWORD=111111 alpine-mysql
docker-compose up -d
It will:
- set no password for 'root' with localhost connections;
- set password for 'root' with non-localhost connections (default is '111111');
- create a new db (default is 'admin');
- create an user and set his password for non-localhost connections only (defaults are 'tony' and 'dpa*12d').