Hi Folks,
I am trying to use docker compose run
to override the replica
setting in the docker-compose.yml
settings.
I have docker compose configurations along the lines of:
services:
frontend:
...
depends_on: backend
backend:
...
e2e:
...
depends_on: e2e-frontend
deploy:
replicas: 0
e2e-frontend:
...
depends_on: backend
deploy:
replicas: 0
Full Source:
- docker-compose.yml · master · Starting Spark / porter / frontend · GitLab
- docker-compose.override.yml · master · Starting Spark / porter / frontend · GitLab
https://gitlab.com/starting-spark/porter/backend/-/blob/master/docker-compose.yml
(sorry, new users can only have 2 links in a post)https://gitlab.com/starting-spark/porter/backend/-/blob/master/docker-compose.override.yml
(sorry, new users can only have 2 links in a post)
With these configurations, I can issue docker compose up
and have frontend
and backend
running during normal development.
When I want to run the end-to-end (e2e) test suite, I can issue:
docker compose up \
--scale e2e=1 \
--scale e2e-frontend=1 \
e2e
My problem comes when I’m trying to run a single e2e test with something along the lines of:
docker compose run e2e \
--scale e2e=1 \
--scale e2e-frontend=1 \
--spec my/single/test.js
Docker compose run
does not recognize the scale
flag.
I tried up
ing first:
docker compose up \
--scale e2e-frontend=1 \
e2e-frontend
and then run
ing:
docker compose run e2e \
--spec my/single/test.js
but run
stops/exits the running e2e-frontend
container (probably because of the replica
setting?).
I think my workaround options are:
- override the e2e/e2e-frontend service
command
when usingup
(could not figure out how to do this) - override the e2e/e2e-frontend service
replica
when usingrun
(could not get this working) - create a separate .yml file that overrides the
replica
setting and append it using the--file
flag (want to avoid needing another .yml file)
Is there a way to accomplish what I want with some magical run
or up
CLI flag?
Thank you for your time