Repository navigation
Conversation
Show the events of the containers of the project, or of the given services, using the events of nerdctl events. The output format is the one of nerdctl events, which is not compatible with Docker. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
…ervices Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
…mposeEvents compose up took about 18s on CI, so the events command reached its timeout before the containers were started and printed nothing. Run compose up in the setup and kill the services while the events command is watching instead. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
…seEvents compose kill alone took about 15s on the EL8 runner, so the events of the killed services arrived at about the time the 20s timeout stopped the events command. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
compose events took the global compose lock and held it until it exited, like every compose command. Since it streams until interrupted, it blocked every other compose command in the meantime, including the compose kill in TestComposeEvents, which therefore only ran after the events command had timed out. Release the lock before streaming, as compose logs does (containerd#3678), and restore the test's timeout. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Contributor
Author
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Contributor
Author
|
The kill is quick now, but the events command still prints nothing in CI and I can't reproduce it locally. I pushed a temporary debug commit to see what it receives, I'll drop it once I know what's going on. |
…arallel Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
cvas22
force-pushed
the
feat/compose-events
branch
from
November 6, 2026 00:36
7bd2371 to
4df1824
Compare
Contributor
Author
|
Found it. The debug run showed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added
nerdctl compose events, one of the Compose commands still listed as unimplemented in the command reference (tracked in #3867).nerdctl compose events [SERVICE...]shows the events of the project's containers, or only those of the given services. It reusessystem.Events, so--formatand--filterwork as innerdctl eventsand the output is the same asnerdctl events, which is not compatible with Docker (the command says so in its help).The only change to the events code is a new optional
LabelsMatcherinSystemEventsOptions. When it is set, the container labels are always looked up and only events of containers it accepts are printed; events that don't belong to a container are dropped. The compose command matches the compose project label and the service label of the selected services. I did not use alabel=filter for this, because severallabelfilters are OR'ed and the project and the service have to match together.Changes:
cmd/nerdctl/compose/compose_events.go: the commandpkg/cmd/system/events.go,pkg/api/types/system_types.go:LabelsMatcherpkg/composer/composer.go:ProjectName()docs/command-reference.md: documented the command and removed it from the unimplemented listNotes
TestComposeEventsstartscompose events svc1in the background, runscompose up -dfor two services and checks that only the events ofsvc1are shown. I could only compile it locally (GOOS=linux go vet), so I'm relying on CI to run it.--since/--untiland Docker's--jsonare not implemented, becausenerdctl eventsdoes not have them either.