Docker: Using COPY when the Dockerfile is located in a subdirectory

前端 未结 2 1061
猫巷女王i
猫巷女王i 2021-02-13 11:16

I\'m building an app using multiple dockerfiles (one for each service). My app\'s directory structure is as follows:

app
├── dockerfiles
│   ├── webserver
│   │          


        
2条回答
  •  青春惊慌失措
    2021-02-13 11:40

    All you need to do here is add context: . and dockerfile in your build section inside your docker-compose.yml file so that your service understands the complete directory structure.

    # docker-compose.yml
    version: "3"
    services:
      webserver:
        build:
          context: .
          dockerfile: ./dockerfiles/webserver/Dockerfile
        image: webserver:php-apache
    

提交回复
热议问题