我尝试使用以下链接提供的示例来将wordpress与mysql连接。
https://www.sitepoint.com/how-to-use-the-official-docker-wordpress-image/
如果不使用卷,它可以正常工作。但是,当我在docker-compose.yml文件中添加了卷时,它开始出现以下错误:
ERROR: yaml.scanner.ScannerError: mapping values are not allowed here
in "./docker-compose.yml", line 16, column 12
docker-compose.yml文件
web:
image: wordpress
links:
- mysql
environment:
- WORDPRESS_DB_PASSWORD=password
ports:
- "127.0.0.3:8080:80"
mysql:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=wordpress
working_dir: /var/www/html
volumes:
- wordpress/wp-content/: /home/tgandhi
感谢您的帮助。