mac docker 安装mysql
ivys-MacBook-Pro:~ txp$ cd ivys-MacBook-Pro:~ txp$ ls Desktop IdeaProjects Music flagship Documents Library Pictures mysql Downloads Movies Public ivys-MacBook-Pro:~ txp$ cd mysql/ ivys-MacBook-Pro:mysql txp$ ls data ivys-MacBook-Pro:mysql txp$ mkdir -p conf ivys-MacBook-Pro:mysql txp$ ls conf data ivys-MacBook-Pro:mysql txp$ cd conf ivys-MacBook-Pro:conf txp$ ls ivys-MacBook-Pro:conf txp$ mkfile docker.cnf usage: mkfile [-nv] size[b|k|m|g] filename ... ivys-MacBook-Pro:conf txp$ ls ivys-MacBook-Pro:conf txp$ mkfile -n docker.cnf usage: mkfile [-nv] size[b|k|m|g] filename ... ivys-MacBook-Pro:conf txp$ mkfile -n 1mb docker.cnf ivys-MacBook-Pro:conf txp$ ls docker.cnf ivys-MacBook-Pro:conf txp$ mkfile -n 1mb mysql.cnf ivys-MacBook-Pro:conf txp$ mkfile -n 1mb mysqldump.cnf ivys-MacBook-Pro:conf txp$ ls docker.cnf mysql.cnf mysqldump.cnf ivys-MacBook-Pro:conf txp$ touch docker.cnf ivys-MacBook-Pro:conf txp$ vim docker.cnf ivys-MacBook-Pro:conf txp$ ls docker.cnf mysql.cnf mysqldump.cnf ivys-MacBook-Pro:conf txp$ vim mysql.cnf ivys-MacBook-Pro:conf txp$ touch mysql.cnf ivys-MacBook-Pro:conf txp$ touch mysql.cnf -100 ivys-MacBook-Pro:conf txp$ vim mysqldump.cnf ivys-MacBook-Pro:conf txp$ docker run -d --name mysql57 --net=backend -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -v /mysql/data:/var/lib/mysql -v /mysql/conf:/etc/mysql/conf.d mysql:5.7.21 Unable to find image 'mysql:5.7.21' locally 5.7.21: Pulling from library/mysql 2a72cbf407d6: Pull complete 38680a9b47a8: Pull complete 4c732aa0eb1b: Pull complete c5317a34eddd: Pull complete f92be680366c: Pull complete e8ecd8bec5ab: Pull complete 2a650284a6a8: Pull complete 5b5108d08c6d: Pull complete beaff1261757: Pull complete c1a55c6375b5: Pull complete 8181cde51c65: Pull complete Digest: sha256:691c55aabb3c4e3b89b953dd2f022f7ea845e5443954767d321d5f5fa394e28c Status: Downloaded newer image for mysql:5.7.21 0d07ab9cdd252f73b92c39be112842567fa8d8a15ef4259d2565da0c617ef36d docker: Error response from daemon: Mounts denied: The path /mysql/data is not shared from the host and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing. See https://docs.docker.com/desktop/mac for more info. ivys-MacBook-Pro:conf txp$ open mysql The file /Users/txp/mysql/conf/mysql does not exist. ivys-MacBook-Pro:conf txp$ cd ~/ ivys-MacBook-Pro:~ txp$ open mysql ivys-MacBook-Pro:~ txp$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql 5.7.21 5195076672a7 4 years ago 371MB
ivys-MacBook-Pro:~ txp$ -e MYSQL_ROOT_PASSWORD=root \
-bash: -e: command not found
ivys-MacBook-Pro:~ txp$ -v /Users/txp/mysql/data/:/var/lib/mysql \
-bash: -v: command not found
ivys-MacBook-Pro:~ txp$ -v /Users/txp/mysql/conf:/etc/mysql/conf.d \
-bash: -v: command not found
ivys-MacBook-Pro:~ txp$ docker run -d --name mysql57 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -v /Users/txp/mysql/data/:/var/lib/mysql -v /Users/txp/mysql/conf:/etc/mysql/conf.d mysql:5.7.21
bab7ce9eac7a5ed403dcf92c70ed126563fc0fc84d003915ad26ac22cd59fecc
ivys-MacBook-Pro:~ txp$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bab7ce9eac7a mysql:5.7.21 "docker-entrypoint.s…" 12 seconds ago Up 12 seconds 0.0.0.0:3306->3306/tcp mysql57
0aee584b12bd nginx "/docker-entrypoint.…" 13 minutes ago Up 13 minutes 0.0.0.0:80->80/tcp nginx