Tag:docker-composedockerfiledocker
Article From:https://segmentfault.com/q/1010000012142656
Question:

Learn docker, use docker-compose to start

DockerfileTo configure:

FROM nginx

COPY src /usr/app/nginx/html

docker-composeTo configure:

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 displays the default page of nginx, not my own HTML page.

Answer 0:

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

default.conf The default path of file root is: /usr/share/nginx/html

Answer 1:

Because you have not mounted the new configuration file, nginx is the default configuration in the container, and the default nginx is certainly not the path to /usr/app/nginx/html.

You can try the mount and configure it.

Leave a Reply

Your email address will not be published. Required fields are marked *