D
D
Dim Boy2020-02-03 21:59:31
Docker
Dim Boy, 2020-02-03 21:59:31

How to use multiple Dockerfiles at the same time?

I get an error when building:

Unsupported config option for services.php: 'context'
Unsupported config option for services.www: 'dockerfile'

version: "3"
services:
    www:
        build:
        context: ./
        dockerfile: ./apache/Dockerfile
        restart: always
        container_name: 'site_com'
        volumes:
            - ./logs:/var/log/apache2
            - ./html:/var/www/
        ports:
            - "8094:80"
            - "8074:443"
        networks:
            - reverse-proxy
            - back
        environment:
            VIRTUAL_HOST: site.com
            LETSENCRYPT_HOST: site.com
            LETSENCRYPT_EMAIL: [email protected]
    php:
        build:
        context: ./
        dockerfile: ./php/Dockerfile
        container_name: site_com_php
        networks:
        - reverse-proxy
        - back
        volumes:
            - ./html:/var/www/

networks:
  reverse-proxy:
    external:
      name: reverse-proxy
  back:
    driver: bridge

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2020-02-03
@twix007

You have trouble with indentation. Check the documentation https://docs.docker.com/compose/compose-file/#build

version: "3"
services:
    www:
        build:
          context: ./
          dockerfile: ./apache/Dockerfile
        restart: always
        ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question