Closed nsteinmetz closed 2 years ago
Can you upgrade to the latest version of Compose v2.4.1
and check if the issue isn't already solved?
As mentioned on twitter with @ndeloof we can't reproduce with the latest version
And can you add the exact error message you get when you try to use the --context
flag with Compose, please?
Just upgraded to 2.4.1 on server A (gitlab) to connect to server B (tooling ; compose version unchanged on this host):
gitlab-runner@gitlab:~/builds/1WShLTsf/0/projectA/core$ docker compose version
Docker Compose version v2.4.1
gitlab-runner@gitlab:~/builds/1WShLTsf/0/projectA/core$ docker --context tooling compose ps -a
NAME COMMAND SERVICE STATUS PORTS
gitlab-runner@gitlab:~/builds/1WShLTsf/0/projectA/core$ docker --context tooling compose ps
NAME COMMAND SERVICE STATUS PORTS
gitlab-runner@gitlab:~/builds/1WShLTsf/0/projectA/core$ docker --context tooling compose -f docker-compose.yml ps
NAME COMMAND SERVICE STATUS PORTS
gitlab-runner@gitlab:~/builds/1WShLTsf/0/projectA/core$
can you please check:
docker --context tooling ps
docker --context tooling inspect <some compose container from previous command> | grep com.docker.compose.project
docker --context tooling compose ls
Hi,
Below the results:
docker --context tooling ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eaa9cce59f14 warp10io/warp10:2.10.1 "/bin/sh -c ${WARP10…" 3 hours ago Up 3 hours 8080-8081/tcp staging-warp10-1
7ccea54ee733 code.boite.fr:5050/project/core/project-core:0.4.3.c4ed1381 "uvicorn app.main:ap…" 4 hours ago Up 4 hours 8000/tcp staging-api-1
a21896bfd99a postgres:14.2 "docker-entrypoint.s…" 4 hours ago Up 4 hours (healthy) 5432/tcp staging-postgres-1
058be71373d2 passbolt/passbolt:3.5.0-ce-non-root "/usr/bin/wait-for.s…" 2 weeks ago Up 2 weeks 4433/tcp, 8080/tcp passbolt-passbolt-1
2217329af435 code.boite.fr:5050/project/docker-images/passbolt-backup:0.1 "crond -f" 2 weeks ago Up 2 weeks passbolt-backup-1
820b1147dc85 mariadb:10.7 "docker-entrypoint.s…" 2 weeks ago Up 2 weeks 3306/tcp passbolt-db-1
78662a53b56b code.boite.fr:5050/project/docker-images/mlflow:1.24.0 "/bin/sh -c 'exec ml…" 3 weeks ago Up 3 weeks 5000/tcp mlflow-mlflow-1
Only the staging-*
containers are part of my compose file and there could be also the mlflow-*
and the passbolt-*
ones.
docker --context tooling inspect eaa9cce59f14 | grep com.docker.compose.project
"com.docker.compose.project": "staging",
"com.docker.compose.project.config_files": "/home/debian/project/staging/docker-compose.yml",
"com.docker.compose.project.working_dir": "/home/debian/project/staging",
and the last one:
docker --context tooling compose ls
NAME STATUS CONFIG FILES
mlflow running(1) /home/debian/datascience/mlflow/docker-compose.yml
passbolt running(3) /home/debian/team/passbolt/docker-compose.yml
staging running(3) /home/debian/project/staging/docker-compose.yml
compose projects were deployed so far locally on target server, like:
From gitlab server, in a gitlab-ci task:
ssh debian@tooling "docker compose -f /home/debian/project/staging/docker-compose.yml up -d"
ok, so docker --context tooling compose ls
was able to detect those (remote) container being part of staging
project.
Can you please check docker --context tooling compose -p staging ps
?
Seems that the issue is about project name indeed (parent dir on gitlab side is core
) and not staging
as on the target server :
docker --context tooling compose -p staging ps
NAME COMMAND SERVICE STATUS PORTS
staging-api-1 "uvicorn app.main:ap…" api running 8000/tcp
staging-postgres-1 "docker-entrypoint.s…" postgres running (healthy) 5432/tcp
staging-warp10-1 "/bin/sh -c ${WARP10…" warp10 running 8080-8081/tcp
Didn't think about it - even if I hit this issue a long time ago but did not remember it when re-using compose for this project...
Unless you see a remaining bug, I think we're done and we can close the issue.
Thanks for your help :)
Description
context seems not supported with docker compose v2
Previously, I could run:
or:
With 2 servers having:
From Server A with context
foo
being set to connect to server B:docker --context foo ps
=> ✅docker --context foo compose ps
=> ❌Describe the results you received:
No output as if no containers were running:
Describe the results you expected:
docker compose should be context aware and allow to run remote commands.
Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker compose version
:Output of
docker info
:Additional environment details:
Debian 11.x Servers - up to date.