docker-compose安装

执行命令

sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

测试安装结果

docker-compose --version

编写 docker-compose.yml文件

version: '3'

networks:
  nginx_bridge:
    driver: bridge

services:
  nginx:
    image: nginx:stable-alpine
    container_name: nginx-stable-alpine
    restart: always
    privileged: true
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 80:80
      - 443:443
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./conf.d:/etc/nginx/conf.d
      - ./log:/var/log/nginx
      - ./www:/opt/www:ro
    networks:
      - nginx_bridge

初次启动

docker-compose up -d
posted @ 2022-09-26 14:23  不止吧  阅读(21)  评论(0编辑  收藏  举报