#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
chmod +x /usr/local/bin/docker-compose

docker compose nginx
1、下载nginx 镜像
docker compose nginx
2、编写compose文件

version: '3.7'
services:
  web:
    restart: always
    container_name: qiduan
    image: nginx:latest
    ports:
      - 10080:80
      - 10443:443
    volumes:
      - ./html:/usr/share/nginx/html
      - ./conf/nginx.conf:/etc/nginx/nginx.conf
      - ./conf.d:/etc/nginx/conf.d      
      - ./logs:/var/log/nginx

docker compose nginx
3、启动

docker-compose up -d 

docker compose nginx

4、查看启动内容

docker-compose ps

docker compose nginx

docker compose nginx

5、docker-compose常用命令

docker-compose up -d --force-recreate   修改配置文件 后重启
docker-compose up -d nginx                     构建建启动nignx容器
docker-compose exec nginx bash            登录到nginx容器中
docker-compose down                              删除所有nginx容器,镜像
docker-compose ps                                   显示所有容器
docker-compose restart nginx                   重新启动nginx容器
docker-compose run --no-deps --rm php-fpm php -v  在php-fpm中不启动关联容器,并容器执行php -v 执行完成后删除容器
docker-compose build nginx                     构建镜像 。        
docker-compose build --no-cache nginx   不带缓存的构建。
docker-compose logs  nginx                     查看nginx的日志 
docker-compose logs -f nginx                   查看nginx的实时日志