docker-compose up --build
尝试从浏览器中访问应用程序(index.php)我可以看到env变量没有覆盖php.ini文件或apache conf文件。你知道我做错了什么吗?
这些是我的档案
docker-compose.yml文件
services:
app:
container_name: myapp
build:
context: .
dockerfile: docker/Dockerfile
volumes:
- .:/var/www/html
ports:
- 8080:80
env_file:
- ./.env
networks:
- appnet
FROM php:7.3-apache-stretch
COPY docker/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY docker/config/php/php.ini /usr/local/etc/php/php.ini
COPY docker/config/php/conf.d/*.ini /usr/local/etc/php/conf.d/
COPY . /var/www/html/
WORKDIR /var/www/html/
php.ini文件
date.timezone = ${PHP_DATE_TIMEZONE}
display_errors = ${PHP_DISPLAY_ERRORS}
error_reporting = ${PHP_ERROR_REPORTING}
.env环境
PHP_DATE_TIMEZONE = Europe/London
PHP_DISPLAY_ERRORS = 1
PHP_ERROR_REPORTING = -1
index.php索引