Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose.yml invalid: app.build contains an invalid type, it should be a string

Running $ docker-compose up when I have my docker-compose.yml as the following, everything works as expected:

app:
  build: . 

However when I have docker-compose.yml as (which appears to valid within the docker-compose reference):

app:
  build:
    context: .

I get the following error:

$ docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because:
app.build contains an invalid type, it should be a string

I've also tried context: "." with no joy. Please help! Many thanks.

like image 826
andyandy Avatar asked Dec 01 '16 18:12

andyandy


1 Answers

The format you're using is for Version 2. You're currently using Version 1 format.

For Version 1, Docker Compose expects a string:

app:
  build: .

For Version 2, Docker Compose expects a string or object, but you must specify that your Docker Compose file is Version 2:

version: '2'
services:
  app:
    build:
      context: .
like image 105
six8 Avatar answered Nov 01 '22 01:11

six8