How to enable all virtual hosts in a Docker container

0

Considering the files below, how can I in the build activate all virtual hosts (present on volume: ./Apache/)?

docker-compose.yaml:

version: "3.3"
services:
  mysql:
    container_name: mysql
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: myapp
      MYSQL_USER: root
      MYSQL_PASSWORD: root
    restart: always
    ports:
      - 3306:3306

  web:
    container_name: web
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ../Desenvolvimento Web/:/var/www
      - ./Apache/:/etc/apache2/sites-available/
    working_dir: /var/www
    depends_on:
      - mysql
    links:
      - mysql
    restart: always
    ports:
      - 80:80

Dockerfile:

FROM php:7.0-apache

RUN apt-get update && apt-get upgrade -y && \
    apt-get install -y \
    bzip2 curl git less mysql-client sudo unzip zip \
    libbz2-dev libfontconfig1 libfontconfig1-dev \
    libfreetype6-dev libjpeg62-turbo-dev libpng12-dev libzip-dev && \
    rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-install bz2 && \
    docker-php-ext-configure gd \
        --with-freetype-dir=/usr/include/ \
        --with-jpeg-dir=/usr/include/ && \
    docker-php-ext-install gd && \
    docker-php-ext-install iconv && \
    docker-php-ext-install opcache && \
    docker-php-ext-install pdo_mysql && \
    docker-php-ext-install zip && \
    a2enmod rewrite && \
    service apache2 restart

RUN curl -sS https://getcomposer.org/installer \
    | php -- --install-dir=/usr/local/bin --filename=composer
    
asked by anonymous 23.09.2017 / 19:49

1 answer

0

Based on your docker-compose, web sees your mysql instance by the name "mysql".

NOTE:

Your definition of:

ports:
    - 3306:3306

In mysql, it is only useful for you host to access mysql, either with the workbench or another tool, its web container is not related.

    
24.09.2017 / 01:19