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.
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: .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With