docker拉取mysql镜像并启动访问

第一步:拉取镜像

  这选择mysql:5.7.28版本,因为之前拉取默认版本无法连接成功,原因未知;

[root@localhost ~]# docker pull mysql:5.7.28
Trying to pull repository docker.io/library/mysql ... 
5.7.28: Pulling from docker.io/library/mysql
804555ee0376: Pull complete 
c53bab458734: Pull complete 
ca9d72777f90: Pull complete 
2d7aad6cb96e: Pull complete 
8d6ca35c7908: Pull complete 
6ddae009e760: Pull complete 
327ae67bbe7b: Pull complete 
31f1f8385b27: Pull complete 
a5a3ad97e819: Pull complete 
48bede7828ac: Pull complete 
380afa2e6973: Pull complete 
Digest: sha256:b38555e593300df225daea22aeb104eed79fc80d2f064fde1e16e1804d00d0fc
Status: Downloaded newer image for docker.io/mysql:5.7.28

第二步:

  启动镜像,端口3306,密码root

[root@localhost ~]# docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7.28
70b956b1ea913b30a42f9f658b6ba626a8500cd2255ee90857e337f84f1b9535

第三步:连接

docker拉取mysql镜像并启动访问_第1张图片

你可能感兴趣的:(docker)