Docker启动一个MySQL服务

# 拉去mysql镜像
[root@localhost]# docker pull mysql:5.7

# 启动一个mysql的服务容器
[root@localhost]# docker run --name docker-mysql-server -e MYSQL_ROOT_PASSWORD=123456 -p 3308:3308 -d mysql:5.7 
57fd57841440ffaa8cc3dce67c20ce033d73d7bc86dc937b4fdc88db35eb457a

# 查看启动情况
[root@localhost]# docker ps -a
CONTAINER ID   IMAGE                COMMAND                  CREATED          STATUS                      PORTS                                                            NAMES
57fd57841440   mysql:5.7            "docker-entrypoint.s…"   4 seconds ago    Up 3 seconds                3306/tcp, 33060/tcp, 0.0.0.0:3308->3308/tcp, :::3308->3308/tcp   docker-mysql-server
posted @ 2022-09-02 18:27  慕夏一缕风  阅读(143)  评论(0编辑  收藏  举报