An OCI container runtime monitor.
Go to file
Giuseppe Scrivano b2f13b0f12
Merge pull request #566 from sohankunkerkar/fix-terminal-size
OCPBUGS-4556: src: Fix terminal resize event processing
2025-06-13 23:03:56 +02:00
.github ci: add go.mod/go.sum validation 2025-05-01 18:06:44 -07:00
.rpmbuild Initial PAPR CI check-in 2018-10-02 17:02:45 -05:00
cmd/conmon-config Use gofumpt 2025-05-01 13:24:57 -07:00
contrib/spec Cirrus: Remove disused scripts 2021-09-28 09:41:55 -04:00
docs logging: Add container labels to log entries on journald 2025-06-01 00:49:41 +03:00
hack fix integration github action 2025-06-05 09:10:32 -04:00
nix Use `.gitignore` in nix build excludes 2024-07-17 09:38:05 +02:00
rpm Bump conmon version to 2.1.13 2025-02-25 13:04:08 -05:00
runner Use gofumpt 2025-05-01 13:24:57 -07:00
src src: Fix terminal resize event processing 2025-06-13 13:03:19 -04:00
.cirrus.yml Remove hack/tree_status.sh 2025-05-01 18:06:47 -07:00
.clang-format Add .clang-format file 2019-05-22 08:40:52 +02:00
.dir-locals.el .dir-locals.el: new file 2020-03-20 08:43:12 -04:00
.gitignore Remove go.sum file and add go.mod 2020-08-27 09:12:36 -04:00
.packit.yaml Packit: enable downstream sync to CentOS Stream 10 2024-05-07 09:37:18 -04:00
CODE-OF-CONDUCT.md Fix docs links due to branch rename 2021-06-10 13:15:32 -04:00
Containerfile Use Podman for building 2020-08-05 11:18:54 -04:00
LICENSE remove appendix 2019-06-17 09:13:38 -04:00
Makefile Makefile: simplify fmt 2025-05-01 18:06:47 -07:00
README.md README.md: update the correct Nix channel 2023-12-13 09:21:17 +08:00
SECURITY.md Fix docs links due to branch rename 2021-06-10 13:15:32 -04:00
VERSION Bump conmon version to 2.1.13 2025-02-25 13:04:08 -05:00
changelog.txt Add Changelog 2019-08-05 10:02:57 -04:00
go.mod Merge pull request #391 from dcermak/go-1-19 2025-05-05 16:27:42 +02:00
go.sum runner: stop using pkg/errors 2025-04-30 19:26:07 -07:00
meson.build Remove checks for (long)deprecated libsystemd-journal in favor of libsystemd 2024-01-26 10:03:37 -05:00

README.md

conmon

An OCI container runtime monitor.

Conmon is a monitoring program and communication tool between a container manager (like Podman or CRI-O) and an OCI runtime (like runc or crun) for a single container.

Upon being launched, conmon (usually) double-forks to daemonize and detach from the parent that launched it. It then launches the runtime as its child. This allows managing processes to die in the foreground, but still be able to watch over and connect to the child process (the container).

While the container runs, conmon does two things:

  • Provides a socket for attaching to the container, holding open the container's standard streams and forwarding them over the socket.
  • Writes the contents of the container's streams to a log file (or to the systemd journal) so they can be read after the container's death.

Finally, upon the containers death, conmon will record its exit time and code to be read by the managing programs.

Written in C and designed to have a low memory footprint, conmon is intended to be run by a container managing library. Essentially, conmon is the smallest daemon a container can have.

In most cases, conmon should be packaged with your favorite container manager. However, if you'd like to try building it from source, follow the steps below.

Dependencies

These dependencies are required for the build:

sudo yum install -y \
  gcc \
  git \
  glib2-devel \
  glibc-devel \
  libseccomp-devel \
  make \
  pkgconfig \
  runc
sudo apt-get install \
  gcc \
  git \
  libc6-dev \
  libglib2.0-dev \
  libseccomp-dev \
  pkg-config \
  make \
  runc

Build

Once all the dependencies are installed:

make

There are three options for installation, depending on your environment. Each can have the PREFIX overridden. The PREFIX defaults to /usr/local for most Linux distributions.

  • make install installs to $PREFIX/bin, for adding conmon to the path.
  • make podman installs to $PREFIX/libexec/podman, which is used to override the conmon version that Podman uses.
  • make crio installs to $PREFIX/libexec/crio, which is used to override the conmon version that CRI-O uses.

Note, to run conmon, you'll also need to have an OCI compliant runtime installed, like runc or crun.

Static build

It is possible to build a statically linked binary of conmon by using the officially provided nix package and the derivation of it within this repository. The builds are completely reproducible and will create a x86_64/amd64 stripped ELF binary for glibc.

Nix

To build the binaries by locally installing the nix package manager:

nix build -f nix/

Ansible

An Ansible Role is also available to automate the installation of the above statically linked binary on its supported OS:

sudo su -
mkdir -p ~/.ansible/roles
cd ~/.ansible/roles
git clone https://github.com/alvistack/ansible-role-conmon.git conmon
cd ~/.ansible/roles/conmon
pip3 install --upgrade --ignore-installed --requirement requirements.txt
molecule converge
molecule verify