Docker-compose the container arrangement

1, the container layout tool allows the user to define a group of containers associated in a template (YAML format), and the like will parameters according --link,

The boot priority to sort
Download and install: curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m`> / usr / local / bin / docker -compose
docker-compose --version

-f specify the file location yaml
// project start up -d container vessel refers not to convert it into a container to start
Display all container information ps
pause pause container
unpause resume suspended
restart Restart container
logs Viewing log information
rm delete container
config -q verify yaml configuration file is correct
stop stop container
start start container // here refers to the case of the container has started
 
docker ps -a -q filtered out of the container corresponding CONTAINER ID
docker rm -f $ (docker ps -a -q) may be behind CONTAINER ID assigned to in the foregoing manner for loop docker rm -f will delete all the container
docker stats db db View container resources consumed
 
 
2, yaml example
version: "2"

services:
  db:
    image: mysql:5.7
    restart: always
    environment:
        MYSQL_ROOT_PASSWORD: somewordpress
        MYSQL_DATABASE: wordpress
        MYSQL_USER: wordpress
        MYSQL_PASSWORD: wordpress
  wordpress:
    depends_on:
       - db
    image: wordpress:latest
    restart: always
    ports:
       - "8080:80"
    environment:
        WORDPRESS_DB_HOST: db:3306
        WORDPRESS_DB_USER: wordpress
        WORDPRESS_DB_PASSWORD: wordpress
 
 
 
 

Guess you like

Origin www.cnblogs.com/Simplelearning/p/12580885.html