• docker-compose


    Install Docker Compose

    1. Official Installation Documentation

    #sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose 
    sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
     
    docker-compose -v
    # docker-compose version 1.24.0, build 0aa59064
    

      

    2. use pip to install

    pip3 install docker-compose==
    
    pip3 install docker-compose==1.28.6
    
    #docker-compose -v
    docker-compose version 1.28.6, build unknown

     

    Use docker-compose

    [0 root@vps /apps/docker_compose] #ss -ntl
    State       Recv-Q Send-Q                        Local Address:Port                                       Peer Address:Port
    LISTEN      0      128                                       *:22                                                    *:*
    LISTEN      0      128                                    [::]:22                                                 [::]:*
    [0 root@vps /apps/docker_compose] #cat docker-compose.yml
    service-nginx-web:
      image: nginx:latest
      container_name: nginx-web
      restart: always
      volumes:
      - /data/nginx:/usr/share/nginx/html/
      expose:
      - 80
      - 443
      ports:
      - "80:80"
      - "443:443"
       
    service-tomcat-app:
      image: tomcat:latest
      container_name: tomcat-app
      expose:
      - 8080
      ports:
      - "8088:8080"
    [0 root@vps /apps/docker_compose] #docker-compose up -d
    Pulling service-nginx-web (nginx:latest)...
    latest: Pulling from library/nginx
    a076a628af6f: Already exists
    0732ab25fa22: Pull complete
    d7f36f6fe38f: Pull complete
    f72584a26f32: Pull complete
    7125e4df9063: Pull complete
    Digest: sha256:10b8cc432d56da8b61b070f4c7d2543a9ed17c2b23010b43af434fd40e2ca4aa
    Status: Downloaded newer image for nginx:latest
    Creating nginx-web  ... done
    Creating tomcat-app ... done
    [0 root@vps /apps/docker_compose] #ss -ntl
    State       Recv-Q Send-Q                        Local Address:Port                                       Peer Address:Port
    LISTEN      0      128                                       *:8088                                                  *:*
    LISTEN      0      128                                       *:443                                                   *:*
    LISTEN      0      128                                       *:80                                                    *:*
    LISTEN      0      128                                       *:22                                                    *:*
    LISTEN      0      128                                    [::]:22                                                 [::]:*
    
    [0 root@vps /apps/docker_compose] # docker-compose up -d --scale service-tomcat-app=2
    
    [0 root@vps /apps/docker_compose] #docker-compose down
    Stopping tomcat-app ... done
    Stopping nginx-web ... done
    Removing tomcat-app ... done
    Removing nginx-web ... done
    [0 root@vps /apps/docker_compose] #ss -ntl
    State Recv-Q Send-Q Local Address:Port Peer Address:Port
    LISTEN 0 128 *:22 *:*
    LISTEN 0 128 [::]:22 [::]:*
    

      

      

     

  • 相关阅读:
    MoSQL
    Open Search Server 1.4 Beta3 发布
    NxWidgets 1.5 发布,NuttX的GUI开发包
    segatex 7.900 发布,SELinux 策略编辑器
    MySQL Connector/ODBC 5.2.4 发布
    Phing 2.5 发布,PHP 项目构建工具
    SwingX 1.6.5 发布,GUI 工具包
    XWiki 4.4.1 发布,Java 的 Wiki 引擎
    流言终结者——C语言内存管理
    Hudson 3.0 正式版发布,持续集成引擎
  • 原文地址:https://www.cnblogs.com/firewalld/p/14635757.html
Copyright © 2020-2023  润新知