Ron H
Ron H

Reputation: 31

Environment variable and docker-compose

When running a number of linked services with docker-compose up, how can I add values for environment variables to be passed to specific containers for services? Say I have a service "webapp" which uses the TIMEOUT environment variable, how do I set TIMEOUT=10000 with docker-compose for the container that "webapp" lives in? I have tried the notation -e TIMEOUT=10000 from the docker command, but this does not seem to work.

Upvotes: 3

Views: 629

Answers (1)

Vaidas Lungis
Vaidas Lungis

Reputation: 1541

with docker compose your have to specify environment variables in docker-compose.yml with env_file or environment configuration commands

https://docs.docker.com/compose/compose-file/#env-file https://docs.docker.com/compose/compose-file/#environment

Upvotes: 2

Related Questions