-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs subcommand does not filter to services from current Compose file #9801
Comments
Can you please provide a more detailed issue that includes the expected output as well as the actual output? I am not seeing an issue on Compose v2.10.2: services:
foo:
image: alpine
init: true
entrypoint: ["sleep", "infinity"]
bar:
image: alpine
init: true
entrypoint: ["sleep", "infinity"] ❯ docker compose -f compose.yaml ps
NAME COMMAND SERVICE STATUS PORTS
ps-bar-1 "sleep infinity" bar running
ps-foo-1 "sleep infinity" foo running After removing ❯ docker compose -f compose-no-bar.yaml ps
NAME COMMAND SERVICE STATUS PORTS
ps-foo-1 "sleep infinity" foo running So I am not seeing output for containers that are not referenced by the Compose file when using the (NOTE: In this example, my project name is |
When using the file model, only attach to services referenced in the active Compose file. For example, let's say you have `compose-base.yaml` and `compose.yaml`, where the former only has a subset of the services but are both run as part of the same named project. Project based command: ``` docker compose -p myproj logs ``` This should return logs for active services based on the project name, regardless of Compose file state on disk. File based command: ``` docker compose --file compose-base.yaml logs ``` This should return logs for ONLY services that are defined in `compose-base.yaml`. Any other services are considered 'orphaned' within the context of the command and should be ignored. See also docker#9705. Fixes docker#9801. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
* logs: filter to services from current Compose file When using the file model, only attach to services referenced in the active Compose file. For example, let's say you have `compose-base.yaml` and `compose.yaml`, where the former only has a subset of the services but are both run as part of the same named project. Project based command: ``` docker compose -p myproj logs ``` This should return logs for active services based on the project name, regardless of Compose file state on disk. File based command: ``` docker compose --file compose-base.yaml logs ``` This should return logs for ONLY services that are defined in `compose-base.yaml`. Any other services are considered 'orphaned' within the context of the command and should be ignored. See also #9705. Fixes #9801. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
docker compose -f ./ProcessFile/AIServer/yaml/AIServer.yaml logs command have same problem,and Compose v2 2.10.2 didn't fix it
#9705
The text was updated successfully, but these errors were encountered: