I have two services in my docker-compose file. Both of them need the same set of environment variables. Is there a better way to do this than duplicating instructions?
PS: I have stored my variables in the "
.env
" file, which resides in the same directory as the docker-compose file.
example docker-compose file:
version: '3'
services:
service_1:
build: './s_1/'
environment:
- variable_1 = ${variable_1}
- variable_2 = ${variable_2}
- variable_x = ${variable_y}
service_2:
build: './s_2/'
environment:
- variable_1 = ${variable_1}
- variable_2 = ${variable_2}
- variable_x = ${variable_y}