Docker install of mysql

From MyWiki
Jump to: navigation, search

Reference: https://hub.docker.com/_/mysql

docker run --name mysql-8 -e MYSQL_ROOT_PASSWORD=<password> -d mysql:8.0.33
docker inspect mysql-8

Note, below the "mysql" directory must be created before running the command

docker run  --name devtest -e MYSQL_ROOT_PASSWORD=<password> -d --mount type=bind,source="$(pwd)"/mysql,target=/var/lib/mysql mysql:latest

With the following syntax the "mysql" directory gets created automatically

docker run  --name devtest -e MYSQL_ROOT_PASSWORD=<password> -d -v "$(pwd)"/mysql:/var/lib/mysql mysql:latest