docker-compose

github上安装compose或者pip安装都可以:pip install docker-compos

1.下载二进制文件

curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

2.对二进制文件添加可执行权限

chmod +x /usr/local/bin/docker-compose

3.测试安装
docker-compose--version
 
 
vim docker-compose.yml
version: '3'
services:
 web:
  build: .
  ports:
    - "8888:80"
 
创建一个cokerfirle:
vim Dockerfile
FROM centos:
MAINTAINER fuyuteng
RUN yum install -y httpd php php-gd php-mysql RUN echo "" > /var/www/html/index.php
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
EXPOSE 80
 
systemctl start docker
docker-compose up
 

 

构建完成

 
docker-compose ps
后台启动:
docker-compose up -d
查看进程:composetest_web_1
docker-compose top web
 
posted @ 2018-08-03 00:14  努力乄小白  阅读(347)  评论(0编辑  收藏  举报