第一次写docker-compose.yml文件
version: '2' services: mysql-server: ports: - "3305:3306" args: - MYSQL_DATABASE=zabbix - MYSQL_USER=zabbix - MYSQL_PASSWORD=zabbix_pwd - MYSQL_ROOT_PASSWORD=root_pwd image: mysql:5.7 zabbix-java-gateway: image: zabbix/zabbix-java-gateway:latest zabbix-server-mysql: args: - DB_SERVER_HOST=mysql-server - MYSQL_DATABASE=zabbix - MYSQL_USER=zabbix - MYSQL_PASSWORD=zabbix_pwd - MYSQL_ROOT_PASSWORD=root_pwd - ZBX_JAVAGATEWAY=zabbix-java-gateway links: - mysql-server:mysql-server - zabbix-java-gateway:zabbix-java-gateway ports: - "10051:10051" image: zabbix/zabbix-server-mysql:latest zabbix-web-nginx-mysql: args: - DB_SERVER_HOST=mysql-server - MYSQL_DATABASE=zabbix - MYSQL_USER=zabbix - MYSQL_PASSWORD=zabbix_pwd - MYSQL_ROOT_PASSWORD=root_pwd links: - mysql-server:mysql - zabbix-server-mysql:zabbix-server ports: - "80:80" image: zabbix/zabbix-web-nginx-mysql:latest
文件写完运行
docker-compose up
报错:
ERROR: yaml.parser.ParserError: while parsing a block mapping in "./docker-compose.yml", line 3, column 3 expected <block end>, but found '<block mapping start>' in "./docker-compose.yml", line 22, column 5 root@ubuntu-xenial:/vagrant/dock# vim
原因文件内块对齐有问题,使用notepad++打开查看如下:
解决办法:
删除15行的args前的空格。
Comments (0)