docker-compose 安装nginx:
cd /usr/local/docker/nginx
mkdir conf
cd conf/
touch nginx.conf
注:./conf/nginx.conf需要先手动创建,否则启动会报错
cd ../
vi docker-compose.yml
version: '3.3'
services:
nginx:
restart: always
image: nginx
container_name: nginx
ports:
- 81:80
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./wwwroot:/usr/share/nginx/wwwroot
docker-compose up -d 启动