Reputation: 846
In docker we can pass environment variable as docker run -e -e "TEST_SUITE=TNT-TestSuite.xml".
Can I do the same or similar for the docker-compose? Right now I had to define this kind envirment varible into the docker-compose.yml file. But I want to pass it when I run the command as docker-compose -e "TEST_SUITE=TNT-TestSuite.xml" up
or something similar? Please let me know.
Upvotes: 1
Views: 7688
Reputation: 234
I am doing it in this way:
Docker-compose part:
some-app:
...
environment:
- ENV_VAR_1=${ENV_VAR_1}
- ENV_VAR_1=${ENV_VAR_2}
command: some command
And then command:
ENV_VAR_1="value1" ENV_VAR_2="value2" docker-compose -f ./docker/docker-compose.yml (path to docker-compose file) run some-app
Upvotes: 3