exec

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: 12 Imported by: 0

README

trace exec example (with filter)

This example shows how to use different packages to create an application to trace the process creation filtering by containers.

This is a more complex setup than the presented in trace/exec/basic example. It also uses the container collection package explained in the container-collection example.

How to build

$ go build .

How to run

Start the tracer in a terminal.

$ sudo ./exec --containername foo

Create a foo container in another terminal:

$ sudo docker run --rm --name foo ubuntu bash -c "cat /dev/null && sleep 2"

The first terminal will print the processes created inside such a container. It's important to notice that even the first processes in the container are traced, bash in this case.

$ sudo ./exec --containername foo
A new "bash" process with pid 445451 was executed in container "foo"
A new "cat" process with pid 445512 was executed in container "foo"
A new "sleep" process with pid 445451 was executed in container "foo"

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