5-Docker实例-安装mysql

2023-12-30 06:38:29

1.拉取mysql镜像

命令:

docker search mysql

docker pull mysql:5.6

[root@centos79 run]# docker pull mysql:5.6
5.6: Pulling from library/mysql
35b2232c987e: Pull complete 
fc55c00e48f2: Pull complete 
0030405130e3: Pull complete 
e1fef7f6a8d1: Pull complete 
1c76272398bb: Pull complete 
f57e698171b6: Pull complete 
f5b825b269c0: Pull complete 
dcb0af686073: Pull complete 
27bbfeb886d1: Pull complete 
6f70cc868145: Pull complete 
1f6637f4600d: Pull complete 
Digest: sha256:20575ecebe6216036d25dab5903808211f1e9ba63dc7825ac20cb975e34cfcae
Status: Downloaded newer image for mysql:5.6
docker.io/library/mysql:5.6
[root@centos79 run]# docker images | grep mysql
mysql                           5.6           dd3b2a5dcb48   24 months ago   303MB
[root@centos79 run]# 

2.使用mysql镜像运行容器

命令:

docker run -it -p 3306:3306 -v /root/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql -d mysql:5.

文章来源:https://blog.csdn.net/z19861216/article/details/135010966
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。