执行命令
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