[root@localhost ~]# docker run -d --name db -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
1f47a4c46796441e238d22250cbd86f90a687ca6f1dd6f5fa11ed5ec54d16a38
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1f47a4c46796 mysql:5.7 "docker-entrypoint.s..." 11 seconds ago Up 9 seconds 3306/tcp, 33060/tcp db
第五步:创建容器BBS,查看容器
bash复制代码
[root@localhost ~]# docker run -d --name bbs --link db:db -p 80:80 tencentci/discuz 01776eb7a064bc7de1818b0345b4105d6812d698a4fda12e295e58dbb5aee474
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
01776eb7a064 tencentci/discuz "docker-php-entrypoi..." About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 443/tcp bbs
1f47a4c46796 mysql:5.7 "docker-entrypoint.s..." 2 minutes ago Up 2 minutes 3306/tcp, 33060/tcp db