docker_practice/appendix/repo/mysql.md

35 lines
896 B
Go
Raw Normal View History

2018-12-14 19:08:14 +08:00
## [MySQL](https://hub.docker.com/_/mysql/)
2016-12-10 17:00:25 +08:00
###
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
[MySQL](https://en.wikipedia.org/wiki/MySQL) 是开源的关系数据库实现。
2018-12-14 19:08:14 +08:00
`https://hub.docker.com/_/mysql/` MySQL 5.5 ~ 8.x
2016-12-10 17:00:25 +08:00
### 使
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
`3306`
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql
```
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
使
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
$ docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql
```
2017-11-24 10:19:15 +08:00
2018-12-15 23:04:32 +08:00
`mysql`
2016-12-10 17:00:25 +08:00
2017-11-22 11:13:23 +08:00
```bash
2017-12-01 17:32:39 +08:00
$ docker run -it --rm \
--link some-mysql:mysql \
mysql \
sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
2016-12-10 17:00:25 +08:00
```
### Dockerfile
2017-11-01 00:36:57 +08:00
https://github.com/docker-library/docs/tree/master/mysql 查看