• 创建docker-compose.yml

  • version: '3'
    
    services:
      apache:
        image: nginx:latest
        container_name: nginx
        ports:
         - "80:80"
        volumes:
         - /root/docker-home/nginx/html:/usr/share/nginx/html
    
    
  • 创建好目录/root/docker-home/nginx/html

  • 在上面的目录下执行命令:

  • docker-compose up -d