docker-compose 是一个可以快速进行多容器编排的神器
安装:

pip install docker-compose

    docker-compose -h 查看子命令:
    常用的命令有:
      docker-compose build # 构建镜像
        docker-compose up    # 编排启动容器 -d 以守护模式启动
        docker-compose start # 启动容器
        docker-compose stop # 停止容器
        docker-compose ps    # 查看容器
        docker-compose rm    # 删除容器

    docker-compose构建lnmp架构示例:
    [root@CentOS7 docker]# tree ./
 ./
└── lnmp
    ├── docker-compose.yml
    ├── mysql
    │   ├── conf
    │   │   └── my.cnf
    │   ├── data
    │   
    ├── nginx
    │   ├── conf.d
    │   │   └── default.conf
    │    |
    │   └── nginx.conf
    └── web
        └── index.php

编辑docker-compose文件:
vim docker-compose.yml              
version: "2"
services:
  php:
    image: php:7.2.3-fpm
    networks:
      - lnmp
    volumes:
       -  ./web:/web
    environment: 
      - TZ=Asia/Shanghai
  nginx:
    image: nginx:1.13
    networks:
      - lnmp
    ports:
      - 80:80
    volumes:
      - ./web:/web
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/conf.d/default..conf:/etc/nginx/conf.d/default.conf
    environment: 
      - TZ=Asia/Shanghai
    links:
      - php
  mysql:
    hostname: mysql
    image: mysql:5.6
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 3306:3306
    networks:
      - lnmp
    volumes:
      - ./mysql/conf:/etc/mysql/conf.d
      - ./mysql/data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
networks:
  lnmp:

执行docker-compose up -d 启动lnmp(注意需要在文件所在的路径下执行)

my.cnf

######### This is a conf of mysql
################ client配置 #####################
#[client]
#port    = 3306
#socket  = /usr/local/mysql/logs/mysql.sock

###############mysql服务端配置##################
[mysqld]    
user    = mysql   
port    = 3306     
################### 存放路径 #####################
#socket  = /usr/local/mysql/logs/mysql.sock
#basedir = /usr/local/mysql
#datadir = /usr/local/mysql/data
#pid-file = /usr/local/mysql/logs/mysql.pid

skip-external-locking
skip-name-resolve

#default-character-set  = utf8   #5.5版本 
character-set-server    = utf8  #5.6版本

lower_case_table_names  = 1 
max_connections     = 10000
open_files_limit    = 65535

wait_timeout        = 600
interactive_timeout = 600

################# mysql日志目录基本配置 ###########
#log-error = /usr/local/mysql/logs/error-log/error.log
#####慢查询设置
slow_query_log      = ON    
slow_query_log_file = slow.log
long_query_time     = 2
log_queries_not_using_indexes
#####二进制日志设置
binlog_format       = "ROW"
log-bin         = mysql-bin
log_bin_index       = binlog.index
relay-log       = relay-bin    
relay_log_index     = mysql_relay_log.index
expire_logs_days    = 30
max_binlog_size     = 60M

############# mysql主主复制配置项 ####################
server-id       = 1
auto_increment_offset   = 1
auto_increment_increment= 2
#log-slave-updates
#slave-skip-errors=all
slave-skip-errors   = 1032,1062
sync_binlog     = 0 # 默认为0,不刷新,由系统决定 # 为1则每一次binlog写入与硬盘同步
#####主从忽略表库配置
replicate-ignore-db = mysql
#replicate-ignore-table=db.table

############# mysql性能配置 ######################
sql_mode        = NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
key_buffer_size     = 200M
tmp-table-size      = 32M
table_open_cache    = 128
table_definition_cache  = 200
query_cache_size    = 32M
query_cache_limit   = 1M
query_cache_min_res_unit= 2k
max_allowed_packet  = 20M
#####与线程有关的配置
thread_concurrency  = 8
thread_cache_size   = 64
sort_buffer_size    = 2M
read_buffer_size    = 2M
read_rnd_buffer_size    = 2M
join_buffer_size    = 2M
#####performance_schema 配置
performance_schema  = off
performance_schema_max_table_instances=100

################ mysql引擎优化 ###########################
myisam-recover-options  = FORCE,BACKUP
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size=10G
myisam_repair_threads   = 1
myisam_recover

#innodb引擎优化       
innodb_read_io_threads      = 8             ####用来同步IO操作的IO线程的数量.
innodb_thread_concurrency   = 8         ####使用InnoDB引擎,内核被允许的线程数,这个最佳值取决于应用程序,硬件还有操作系统的调度程序。太高的值肯定会导致线程抖动。
innodb_flush_log_at_trx_commit  = 1     ####如果设置为1 ,InnoDB会在每次提交后刷新(fsync)事务日志到磁盘上,
innodb_log_buffer_size      = 2M            ####用来缓冲日志数据的缓冲区的大小.
innodb_log_file_size        = 100M            ####在日志组中每个日志文件的大小,
innodb_log_files_in_group   = 3          ####在日志组中文件的总量,通常2-3就足够了
innodb_max_dirty_pages_pct  = 90        ####在InnoDB缓冲池中最大允许的脏页面的比例.
innodb_lock_wait_timeout    = 120         ####在被回滚前,一个InnoDB的事务应该等待一个锁被批准多久.

################ mysql备份命令配置 #######################
[mysqldump]
quick

############## mysql热备份命令配置 #######################
[mysqlhotcopy]
interactive-timeout

[mysql]
prompt          = \\u@mysql \\r:\\m:\\s->   #修改登陆默认提示符

nginx.conf

#user  nginx;
worker_processes  auto; # cpu密集型写cpu个数,其他写cpu的2倍,偷懒写auto
#worker_cpu_affinity 0001 0010 0100 1000; # 线程绑定cpu

worker_rlimit_nofile    65536;
error_log  /var/log/nginx/error.log info; 
#pid        logs/nginx.pid;

events
{
    use epoll;  # 复用客户端线程的轮询方法
    accept_mutex off;
    worker_connections  65536;
}

http
{
    include       mime.types;
    default_type  text/html;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"'
          '"$upstream_cache_status"';
    access_log  /var/log/nginx/access.log  main;

    sendfile    on;
    server_tokens off; # 隐藏Nginx版本号
    keepalive_timeout  60;
    client_header_buffer_size 4k;
    client_body_buffer_size 320k;
    client_max_body_size     8m;
    keepalive_requests  8192;
    large_client_header_buffers 4 32k;
    server_names_hash_bucket_size 128; 

    open_file_cache max=65536  inactive=60s;
    open_file_cache_valid      80s;
    open_file_cache_min_uses   1;

    proxy_connect_timeout 50;
    proxy_read_timeout 50;
    proxy_send_timeout 50;
    proxy_buffer_size 320k;
    proxy_buffers  4 640k;
    proxy_busy_buffers_size 1280k;
    proxy_temp_file_write_size 1024m;
    proxy_ignore_client_abort on;
    proxy_temp_path  /tmp/temp;
    proxy_cache cache_one;
    proxy_cache_valid 200 302 1m;
    proxy_cache_valid 301 1m;
    proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;

    proxy_redirect          off;    
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    add_header X-Cache-Status $upstream_cache_status;
    proxy_http_version 1.1;
    proxy_set_header Connection "";

    fastcgi_temp_path  /tmp/fastcgi_temp; # php缓存配置
    fastcgi_cache_path /tmp/fastcgi_cache levels=1:2 keys_zone=cache_fastcgi:128m inactive=30m max_size=1g;
    fastcgi_cache_key $request_method://$host$request_uri;
    fastcgi_cache_valid 200 302 1h;
    fastcgi_cache_valid 301     1d;
    fastcgi_cache_valid any     1m;
    fastcgi_cache_min_uses 1;
    fastcgi_cache_use_stale error timeout http_500 http_503 invalid_header;

    gzip  on;
    gzip_min_length 1k;   # 指定压缩文件的最小尺寸
    gzip_buffers  4 64k;
    gzip_http_version 1.1;
    gzip_comp_level 2;  # 压缩等级为2
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;  # 允许压缩的文件类型

    charset UTF-8;

  include /etc/nginx/conf.d/*.conf;
  #include /usr/local/nginx/conf/httpsconf/*.conf;
  }

default.conf

server {
    listen       80;
    server_name  localhost;

    location / {
        root   /web;
        index  index.html index.htm;
    }

    location ~ \.php$ {
        root           /web;
        fastcgi_pass   php:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /web$fastcgi_script_name;
        include        fastcgi_params;
    }

        location ~ .+\.(gif|jpg|jpeg|png|bmp|swf|txt|csv|doc|docx|xls|xlsx|ppt|pptx|flv)$
        {
            expires 30d; # 静态文件缓存时间
        }

        location ~ .+\.(js|css|html|xml)$
        {
            expires 30d;
        }

}