DEV Community

Discussion on: PHP + MySQL using Docker Compose

Collapse
 
ripsup profile image
Richard Orelup • Edited

Thanks for the article. While trying to run through the above I ran into this error

ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType.

which I solved by updating docker-compose.yml to this

version: '3'

services:
  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: my_secret_pw_shh
      MYSQL_DATABASE: test_db
      MYSQL_USER: devuser
      MYSQL_PASSWORD: devpass
    ports:
      - "9906:3306"
  web:
    image: php:7.2.2-apache
    container_name: php_web
    depends_on:
      - db
    volumes:
      - ./php/:/var/www/html/
    ports:
      - "8100:80"
    stdin_open: true
    tty: true
Enter fullscreen mode Exit fullscreen mode

The indentation matters and this finally got it working. Hope this helps anyone else trying to use this.

Collapse
 
alysivji profile image
Aly Sivji

Thanks for the heads up!

Didn't realize the indentation got messed up as I copied this over. It has been corrected.

Collapse
 
ripsup profile image
Richard Orelup

I'm just getting in to Docker so I'm actually glad it had that issue so I'm now aware that I have to get the indentation correct. :)