I have a docker-compose.yml that have been written for the option to run parallel in CI from different locations.
But when I'm trying to run docker-compose up
for the second time the containers of the first docker-compose's containers are shutting.
version: '3.7'
x-default-values: &default-values
image: some_image:${CI_JOB_ID}
env_file:
- env_file.txt
init: true
volumes:
- "first_vol:/some/path"
- "second_vol:/some/path2"
x-rest-default-values: &rest-default-values
image: some_image:${CI_JOB_ID}
volumes:
- "first_vol:/some/path"
init: true
volumes:
first_vol:
name: ${CI_JOB_ID_first_vol
second_vol:
name: ${CI_JOB_ID}_second_vol
external: true
networks:
default:
name: ${CI_JOB_ID}_net
external: true
services:
some_service:
container_name: ${CI_JOB_ID}_some_service
command: "some command"
<<: *default-values
env_file:
- ${CI_PROJECT_DIR}/env_file.txt
some_rest_service:
container_name: ${CI_JOB_ID}_some_rest_service
command: "some rest command"
<<: *rest-default-values
localstack:
container_name: ${CI_JOB_ID}_localstack
image: localstack:${CI_JOB_ID}
env_file:
- ${CI_PROJECT_DIR}/env_file.txt
environment:
- EDGE_PORT=4566
- SERVICES=sqs,sns,s3
My docker-compose.yml look like this with more services but with pretty much same templates. Trying to understand what I'm missing that causing the docker-compose collapse when running more than one instance (those instances are running from different location: CI_PROJECT_DIR and with other CI_JOB_ID).
I can reproduce it locally and "debug" it, but I'm not sure what should I look for (the external volume is exist and also the network and the flow is fine when running one instance). So I would like to get an advise how to investigate it further.
I tried to run multiple instances of docker-compose in parallel. Expected to work but to container of the first instance are shutting down after the second instance is up.