Managing environment configurations in Docker Compose
Karthik T
1 min read
Managing environment configurations in Docker Compose can be streamlined by using different .env files for various environments. Here's a guide on how to set this up effectively.
Keep both the docker-compose.yaml file .env files in same directory
docker-compose.yaml
version: "3"
services:
demo:
image: vinsdocker/sel-app:${VERSION}
ports:
- 80:80
dev.env
VERSION=v2
qa.env
VERSION=v3
The command to use qa.env file while running docker-compose file:
docker-compose --env-file qa.env up
The command to use dev.env file while running docker-compose file:
docker-compose --env-file de.env up
1
Subscribe to my newsletter
Read articles from Karthik T directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Karthik T
Karthik T
Experienced SDET with expertise in building hybrid UI & API automation frameworks using Playwright, Selenium, RestAssured and Docker ,Proficient in delivering scalable test solutions with comprehensive reporting