docker-compose应用
1、编写模板文件
#新建文件夹
mkdir -p /tzh/compose_test
#进入文件夹
cd /tzh/compose_test
#新建docker-compose.yml文件,内容如下:
vim docker-compose.yml
docker-compose.yml文件内容如下
version
2、启动
#进到当前目录
[root@tzh compose_test]# pwd
/tzh/compose_test
[root@tzh compose_test]# ls
docker-compose.yml
#启动 docker-compose up -d
3、验证
[root@tzh compose_test]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
11fb9825321f tomcat "catalina.sh run" 26 seconds ago Up 26 seconds 0.0.0.0:8080->8080/tcp compose_test_web_1
d9d621c870e2 centos/mysql-57-centos7 "container-entrypoin…" 11 minutes ago Up About a minute 0.0.0.0:3308->3306/tcp mysql
eda7e1c5c027 redis "docker-entrypoint.s…" 11 minutes ago Up About a minute 0.0.0.0:16379->6379/tcp redis
可以看到我们刚刚跑的容器了