For example, if I have a docker compose file and like the following:
version: '3.7'
services:
my_app:
image: my_app/image
restart: always
links:
- mysql
mysql:
image: mysql
restart: always
Is there a way to create and run more than 1 container of my_app without explicitly stating another one? The catch is, each app would use different env variables; each app instance would process for a different user accounts. This would be different from k8s as I'm not trying to scale horizontally. Or would I need to create a file like the following:
version: '3.7'
services:
my_app1:
image: my_app/image
restart: always
environment:
- ACCOUNT=1
- ACCOUNT=2
- ACCOUNT=3
links:
- mysql
my_app2:
image: my_app/image
restart: always
environment:
- ACCOUNT=4
- ACCOUNT=5
- ACCOUNT=6
links:
- mysql
my_app3:
image: my_app/image
restart: always
environment:
- ACCOUNT=7
- ACCOUNT=8
- ACCOUNT=9
links:
- mysql
mysql:
image: mysql