Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

669
Visualizações
Docker DNS multiple containers with apache vhosts (wildcard domain)

For the company I work at, I setup a docker environment using docker-composer and multiple containers so we can all benefit from having the same environment. I created a subdomain DNS record (dev.company.com) pointing to 127.0.0.1. This works fine for reaching projects from within the browser to the appropriate Apache vhosts. The problem however is that we cannot resolve this domain within the PHP container because the DNS points towards 127.0.0.1 how can I add a custom entry to the docker php container to resolve *.dev.company.com to the Apache container?

Also adding this to /etc/hosts is not really an option because we run like 50+ projects.

I found some solutions online which just said to add php to the same container, but this kinda defeats the purpose of having separate containers per service. Added docker-composer file as reference.

Note: I'm the only one using Linux in the office other colleagues are using Docker on Windows or Mac, so a Linux only solution won't cut it :)

version: "3.7"
services:
    php:
        build: php
        env_file:
            - ./conf/php.config.env
        volumes:
            - ./htdocs:/htdocs
        expose:
            - "9000"
        links:
            - mysql
            - mssql
            - mail
        restart: always
        init: true
    apache:
        build: apache
        volumes:
            - ./htdocs:/htdocs:ro
        ports:
            - "80:80"
            - "443:443"
        links:
            - php
        restart: always
        init: true
    mysql:
        build: mysql
        env_file:
            - ./conf/mysql.config.env
        volumes:
            - ./mysql/data:/var/lib/mysql
        ports:
            - "3306:3306"
        restart: always
    mssql:
        image: microsoft/mssql-server-linux
        env_file:
            - ./conf/mssql.config.env
        volumes:
            - ./mssql/data:/var/opt/mssql/data
        ports:
            - "1433:1433"
        restart: always
    mail:
        image: schickling/mailcatcher
        ports:
            - "1080:1080"
        restart: always
        init: true
    redis:
        image: redis
        expose:
            - "6379"
        links:
            - php
        restart: always
        init: true
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda