The convenience brought by the Docker-compose

Source: Internet
Author: User

Docker-compose is an open-source Docker management tool for simplifying complex container environments.


Docker-compose can easily deploy a set of environments in conjunction with Swarm and Docker process container deployments.


The specific process is as follows:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/46/wKioL1c9LSrwieMrAAA9K-eHDy4315.png "title=" 1.png " alt= "Wkiol1c9lsrwiemraaa9k-ehdy4315.png"/>


Docker-compose use of the V2 version


Official documents:

https://docs.docker.com/compose/compose-file/#version-2


Docker-compose was written in Python, so we installed


Use pip install Docker-compose to install Docker-compose


Upgrade ssl_match_hostname greater than or equal to 3.5.1 To use Docker-compose


Pip Install Backports.ssl_match_hostname--upgrade



The following is the V2 version of Docker-compose.yaml


version:  ' 2 '                   #  using compose v2  version networks:                     #  Define a network          network-cn:          #  Define Network Name                  external:                             name: ovrcn      #  Using a self-created network, if you do not set this, you will automatically create a different network than your original network. services:  #  Service Group name         nginx-1:                 image: nginx                           #  Mirroring                  networks:                           network-cn:                    #  Custom Network Name                                  aliases:                                           &nbsNetwork aliases for p;  - nginx       # overlay  Networks                  hostname: nginx                         #   hostname           inside the container       container_name: nginx-1                #  container name when creating a container                  ports:                                  #  Map Ports                  -  "80:80"                  -  "443:443"                  environment:                           # --env  Configuration                  - constraint:node== swarm-node-28                 volumes:                               #  Mount Directory                  - /opt/data/nginx/logs:/opt /local/nginx/logs


Finish writing Docker-compose.yaml use Docker-compose up-d to create the container.



Use the Docker-compose PS command to view the boot status of the container.

Name Command State Ports

-----------------------------------------------------------------------------------

Nginx-1/opt/local/nginx/sbin/ngin ... Up 172.16.1.28:443->443/tcp, 172.16.1.28:80->80/tcp

The convenience brought by the Docker-compose

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.