I am trying to up phpserver via docker-compose.
(我正在尝试通过docker-compose来启动phpserver。)
I put 3 files in my working directory. (我在工作目录中放入了3个文件。)
.env docker-compose.yml Dockerfile
(.env docker-compose.yml Dockerfile)
.env
(.env)
##PATHS
DB_PATH_HOST=./databases
APP_PATH_HOST=./blog
APP_PATH_CONTAINER=/var/www/html/
MYSQL_ROOT_PASSWORD=123456
docker-compose.yml
(docker-compose.yml)
version: '3'
(版本:“ 3”)
services:
web:
build: .
environment:
- APACHE_RUN_USER=www-data
volumes:
- ${APP_PATH_HOST}: ${APP_PATH_CONTAINER}
ports:
- 8080:80
working_dir:
- ${APP_PATH_CONTAINER}
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- ${DB_PATH_HOST}: /var/lib/mysql
adminer:
image: adminer
restart: always
ports:
- 6080:8080
composer:
image: composer:1.7
volumes:
- ${APP_PATH_HOST}: ${APP_PATH_CONTAINER}
working_dir: ${APP_PATH_CONTAINER}
command: composer install
and Dockerfile
(和Dockerfile)
FROM php:7.2-apache
RUN docker-php-ext-install
pdo_mysql
&& a2enmod
rewrite
But after I try to run
(但是在我尝试跑步之后)
docker-compose up --build
I have the problem
(我有问题)
ERROR: The Compose file '.docker-compose.yml' is invalid because:
services.web.working_dir contains an invalid type, it should be a string
services.composer.volumes contains an invalid type, it should be a string
services.web.volumes contains an invalid type, it should be a string
services.db.volumes contains an invalid type, it should be a string
I tried to change docker-compose file version to 2 - does not work I tried to use '' and "" the same problem.
(我试图将docker-compose文件版本更改为2-不起作用,我尝试使用“和”相同的问题。)
I want to run my server successfully.
(我想成功运行服务器。)
ask by Виктор Васильев translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…