Use docker-compose to configure a small demo

  docker, question

Learn docker and use docker-compose to start

图片描述

Dockerfile configuration:

FROM nginx
 
 COPY src /usr/app/nginx/html

Docker-compose configuration:

version: '2'
 services:
 app:
 build: .
 image: app:1.0.0
 volumes:
 - ./src:/usr/app/nginx/html
 ports:
 - "8080:80"

Then run the command

docker-compose up

The browser opens: localhost:8080, but the page shows the default page of nginx instead of my own html page

Modify path /usr/app/nginx/html to /usr/share/nginx/html
Details

Default.conf fileroot the default path is: /usr/share/nginx/html