Как настроить мой Dockerfile или docker-compose для того, чтобы мой хост-компьютер мог разрешать ServerName, например http://myapp.env вместо http://localhost:8080?!
Я попытался настроить файл локальных хостов с помощью ip изконтейнер, но безуспешно, вот так
172.20.0.3 goforce.env
Мой Dockerfile
FROM php:7.2-apache
LABEL maintainer="rIckSanchez"
LABEL project="MyApp"
COPY .docker/php/php.ini /usr/local/etc/php/
COPY .docker/apache/000-default.conf /etc/apache2/sites-available/
COPY . /srv/app
RUN apt-get update && apt-get install --no-install-recommends -y \
wget \
nano \
git \
unzip \
iputils-ping
# Install PHP extensions deps
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
zlib1g-dev \
libicu-dev \
g++ \
unixodbc-dev \
libxml2-dev \
libaio-dev \
libmemcached-dev \
freetds-dev \
libssl-dev \
openssl
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin \
--filename=composer
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu \
&& pecl install sqlsrv-4.1.6.1 \
&& pecl install pdo_sqlsrv-4.1.6.1 \
&& pecl install redis \
&& pecl install memcached \
&& docker-php-ext-install \
iconv \
mbstring \
intl \
gd \
mysqli \
pdo_mysql \
pdo_dblib \
soap \
sockets \
zip \
pcntl \
ftp \
&& docker-php-ext-enable \
sqlsrv \
pdo_sqlsrv \
redis \
memcached \
opcache
RUN a2enmod rewrite negotiation
RUN chown -R www-data:www-data /srv/app
RUN service apache2 restart
Мой Docker-compose
version: "3"
networks:
app-tier:
driver: bridge
services:
app:
image: laravel-app
container_name: laravel-app
networks:
- app-tier
build:
context: .
dockerfile: .docker/Dockerfile
depends_on:
- redis
ports:
- 8080:80
volumes:
- .:/srv/app
redis:
image: redis:4-alpine
container_name: laravel-redis
networks:
- app-tier
ports:
- 16379:6379
volumes:
- redis:/data
volumes:
redis:
driver: "local"
Мой 000-файл default.conf
<VirtualHost *:80>
ServerName myapp.env
ServerAdmin webmaster@localhost
DocumentRoot /srv/app/public
<Directory "/srv/app/public">
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>