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