docker_practice/appendix/repo/mysql.md

35 lines
896 B
Go
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## [MySQL](https://hub.docker.com/_/mysql/)
###
[MySQL](https://en.wikipedia.org/wiki/MySQL) 是开源的关系数据库实现。
`https://hub.docker.com/_/mysql/` MySQL 5.5 ~ 8.x
### 使
`3306`
```bash
$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql
```
使
```bash
$ docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql
```
`mysql`
```bash
$ 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"'
```
### Dockerfile
https://github.com/docker-library/docs/tree/master/mysql 查看