How do I fix my docker-compose.yml? – expected , but found ”

In the future, you could use this website to check what is wrong with it and then fix it on the go.

EDIT:

So the problems you had with your docker-compose file were as follows:

  1. You didn’t added the services: keyword after the version and

  2. You don’t have to pass the :latest tag if you want the latest image, you will pass the tag when you want a specific version of the image and that’s done between ” “


As for the code, it should be as follows:

version: '2'

services:
      ghost:
        image: ghost
        container_name: ghost-blog
        environment:
          - NODE_ENV=production
          - MYSQL_DATABASE=db-name
          - MYSQL_USER=user
          - MYSQL_PASSWORD=pass
      #   - "MAILGUN_USER={{mailgun-user}}"
      #   - "MAILGUN_PASSWORD={{mailgun-password}}" # Change {{mailgun-password}}
        volumes:
         - ./ghost:/var/lib/ghost # persist the data
        ports:
          - 2368:2368
        depends_on:
          - mysql # ensure that the database will always start first
        restart: always
    
      mysql:
        image: mysql
        container_name: ghost-db
        environment:
          - MYSQL_DATABASE=dbname # Change {{db-name}}
          - MYSQL_ROOT_PASSWORD=db-pass # Change {{root-password}}
          - MYSQL_USER=user # Change {{username}}
          - MYSQL_PASSWORD=sq-pass # Change {{db-password}}
        volumes:
          - ./db:/var/lib/mysql
        restart: always

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)