yaml: line 8:did not find expected key

Viewed 5422

these are my first times with docker, I'm trying to put the directives for MariaDB in my composer file. Once the file is written, if I try to run the docker compose up command, it gives me the following error: yaml: line 8: did not find expected key. Does anyone have the same problem as me? How can I solve? Thanks so much.

Below is my docker-compose.yaml file

version: '3'
    services:
      backend:
        build: ./
        restart: always
        volumes:
          - ./application:/var/www/html
        ports: [80:80]
       mariadb:
        image: 'bitnami/mariadb:latest'
        ports:
            - '3306:3306'
        volumes:
            - './mariadb_data:/bitnami/mariadb'
        environment:
            - ALLOW_EMPTY_PASSWORD=yes
            - MARIADB_DATABASE=db_test
            - MARIADB_USER=test_user
            - MARIADB_PASSWORD=password
            - MARIADB_ROOT_HOST='%'
    volumes:
      application:
        driver: local
      mariadb_data:
        driver: local
1 Answers

It happens when we do our own yml file for docker, you need to indent two spaces for sub entries under image details:

version: '1'
services:
    mariadb-ikg:
      image: bitnami/mariadb:10.3
      ports:
        - 3306:3306
      volumes:
        - D:/docker/bitnami-mariadb/databases:/bitnami/mariadb
      environment:
        - MARIADB_ROOT_PASSWORD=123456
    phpfpm-ikg:
      image: wyveo/nginx-php-fpm:php80
      ports:
        - 80:80
      volumes:
        - D:/docker/wyveo-nginx-php-fpm/wordpress:/usr/share/nginx/html
      depends_on:
        - mariadb-ikg
Related