Jaquarh
Jaquarh

Reputation: 6673

How can I load environment variables into docker-compose?

I am trying to pass arguments into my local docker-compose.yml file through a configuration file. My docker-compose.yml looks like this:

version: '3'

services:

    app:
        build:
            context: .
        image: {$WEB_DOMAIN_NAME}/app
        ...

My .env looks like this:

server.conf

My server.conf looks like this:

WEB_DOMAIN_NAME = example.co.uk

However, when I try to run docker-compose up -d I get this error

ERROR: yaml.parser.ParserError: while parsing a block mapping in ".\docker-compose.yml", line 6, column 9 expected , but found '' in ".\docker-compose.yml", line 8, column 34

How can I load my server.conf into this?

Upvotes: 0

Views: 74

Answers (1)

prisar
prisar

Reputation: 3195

you copy the contents of server.conf to .env. It can be manually or through script.

Upvotes: 1

Related Questions