目录
使用 Docker 来管理 MySQL、Redis 等各种中间件是十分方便的,无论是生产环境,还是开发环境都非常方便。今天来说一下我用 Docker 来管理 MySQL 时遇到的一个小坑。
在 Docker 下部署 MySQL
在 Docker 下部署 MySQL 是很方便的,通过几条命令就可以轻轻松松的下载镜像并完成安装部署。
首先,拉取MySQL镜像:
% docker pull mysql:latest
latest: Pulling from library/mysql
a076a628af6f: Already exists
f6c208f3f991: Pull complete
88a9455a9165: Pull complete
406c9b8427c6: Pull complete
7c88599c0b25: Pull complete
25b5c6debdaf: Pull complete
43a5816f1617: Pull complete
1a8c919e89bf: Pull complete
9f3cf4bd1a07: Pull complete
80539cea118d: Pull complete
201b3cad54ce: Pull complete
944ba37e1c06: Pull complete
Digest: sha256:feada149cb8ff54eade1336da7c1d080c4a1c7ed82b5e320efb5beebed85ae8c
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest
上面的命令是拉取最新的MySQL镜像。然后查看下载的镜像。
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c8562eaf9d81