执行docker-compose命令后获得错误yaml.scanner.ScannerError

时间:2018-08-09 06:31:24

标签: docker docker-compose

Docker撰写文件:

version: '2'

services:

wordpress:
    image: wordpress
    ports:
        -8080:80
    environment:
        WORDPRESS_DB_PASSWORD:vvk123
mysql:
    image:mysql:latest
    environment:
        MYSQL_ROOT_PASSWORD:vvk123

当我试图执行此命令时

docker-compose ps

其给出的错误称为

  

yaml.scanner.ScannerError:此处不允许映射值   “。\ docker-compose.yml”,第12行,第20列

1 个答案:

答案 0 :(得分:1)

尝试在第12行的列之后添加一个空格:

version: '2'

services:

wordpress:
    image: wordpress
    ports:
        - 8080:80
    environment:
        - WORDPRESS_DB_PASSWORD:vvk123
mysql:
    image: mysql:latest
    environment:
        - MYSQL_ROOT_PASSWORD:vvk123