码迷,mamicode.com
首页 > 其他好文 > 详细

docker-compose部署微服务

时间:2019-10-18 15:45:26      阅读:78      评论:0      收藏:0      [点我收藏+]

标签:lease   进入   doc   src   安装   多命令   hang   技术   family   

1、安装docker-compose

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

面安装的是稳定版本1.23.2的 docker-compose,可以到github上找最新版 https://github.com/docker/compose/releases

执行如下命令,查看是否安装成功:

docker-compose version

技术图片

2、创建docker-compose.yml文件

version: ‘3‘

services:

  demo-tm:
    image: registry.cn-shanghai.aliyuncs.com/demo-store/demo_online:demo-tm-v1.0
    container_name: demo-tm
    ports:
      - 7970:7970
      - 8070:8070
    networks:
      - netName

  demo-usercenter:
    image: registry.cn-shanghai.aliyuncs.com/demo-store/demo_online:demo-usercenter-v1.0
    container_name: demo-usercenter
    ports:
      - 9001:9001
    networks:
      - netName

  demo-pay:
    image: registry.cn-shanghai.aliyuncs.com/demo-store/demo_online:demo-pay-v1.0
    container_name: demo-pay
    ports:
      - 9009:9009
    volumes:
      - /home/pinganBank:/home/pinganBank
    networks:
      - netName

  demo-gateway:
    image: registry.cn-shanghai.aliyuncs.com/demo-store/demo_online:demo-gateway-v1.0
    container_name: demo-gateway
    ports:
      - 10001:10001
    networks:
      - netName
  
networks:
  netName:
    driver: bridge

3、进入docker-compose.yml所在文件夹,执行以下命令,启动服务

docker-compose up -d

4、其他相关docker-compose命令

     停止所有服务

decker-compose stop

  停止某服务

docker-compose stop demo-usercenter

  删除所有服务镜像

docker-compose rm

  其他更多命令可参考:https://www.cnblogs.com/moxiaoan/p/9299404.html

 

docker-compose部署微服务

标签:lease   进入   doc   src   安装   多命令   hang   技术   family   

原文地址:https://www.cnblogs.com/conswin/p/11698428.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!