container-collection

command
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

Container Collection Example

This is a basic example that uses the container-collection package ("github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection") to print a message when a container is created or removed.

How to build

$ go build .

How to run

Start the example in one terminal. It'll print the already existing containers:

$ sudo ./container-collection
Container added: "local-registry" pid 6135

In another terminal, run a container:

$ docker run --name hi -rm ubuntu /bin/bash -c "echo hi && sleep 2"
hi

The previous terminal will contain messages indicating the creation and removal of this container:

$ sudo ./container-collection
Container added: "local-registry" pid 6135
Container added: "hi" pid 130258
Container removed: "hi" pid 130258

More information

The kube-container-collection example contains a more complex setup using this package.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL