version: "3.1"
services:
redis:
image: redis:alpine
container_name: larablog-redis
代码工作正常,直到我添加了以下服务
db:
image: mysql:8.0
container_name: larablog-mysql
working_dir: /application
volumes:
- ./src:/application
environment:
- MYSQL_ROOT_PASSWORD=rootpass
- MYSQL_DATABASE=larablog
- MYSQL_USER=larauser
- MYSQL_PASSWORD=larauserpass
ports:
- "8890:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_ARBITRARY: 1
MYSQL_USER: larauser
MYSQL_PASSWORD: larauserpass
MYSQL_ROOT_PASSWORD: rootpass
ports:
- "80:80"
links:
# for mysql container
- "db:db"
volumes:
db:
driver: "local"
我正在尝试按照我在https://gotechnies.com/docker-compose-yml-mysql-phpmyadmin/找到的方法,但我无法从头开始,因为我也需要laravel框架
webserver:
image: nginx:alpine
container_name: larablog-webserver
working_dir: /application
volumes:
- ./src:/application
- ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8888:80"
php-fpm:
build: phpdocker/php-fpm
container_name: larablog-php-fpm
working_dir: /application
volumes:
- ./src:/application
- ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.1/fpm/conf.d/99-overrides.ini
当我尝试运行docker-compose up -d ...
时出现此错误ERROR: yaml.parser.ParserError: while parsing a block mapping
in ".\..\docker-compose.yml", line 27, column 6
expected <block end>, but found '<block mapping start>'
in ".\..\docker-compose.yml", line 35, column 9
如何克服此错误?