conmon-v3 - Man Page

conmon - OCI container monitor used by Podman and CRI-O

Synopsis

conmon [Options] -c CID --runtime PATH

Create/run, exec into, or restore a container while handling logging, exit status reporting, and lifecycle integration for higher-level tools.

Description

conmon is a small, feature-focused OCI container monitor used primarily by Podman and CRI-O. It launches an OCI runtime (such as runc), keeps track of the container process, manages attach sockets, handles stdio, writes exit status files, and forwards container logs to a pluggable logging backend.

The same command-line interface supports multiple logical modes:

The mode is selected using flags such as --exec, --restore, and --version, not by subcommands.

Options

Unless stated otherwise, boolean options are disabled by default and become enabled when specified. Options marked "(multiple)" may be given more than once.

General options

--version

Print the conmon version and exit.

--api-version=INT

Conmon API version to use. If omitted, defaults to 0. API version affects exec/attach behavior: attaching to an exec session (--exec-attach) is only allowed when --api-version is at least 1.

-c,  --cid=STRING

Container ID. This uniquely identifies the container instance and is required for all modes other than --version​. If missing, conmon fails with "Container ID not provided. Use --cid".

-u,  --cuuid=STRING

Container UUID. Required for create/run and restore, and for exec with non-legacy API versions. It may be omitted only for legacy exec mode when --api-version is less than 1 and --exec is used. Otherwise conmon fails with "Container UUID not provided. Use --cuuid".

-n,  --name=STRING

Human-readable container name. This is used in logging metadata and may appear in log records depending on the configured log driver.

-b,  --bundle=PATH

Location of the OCI bundle directory. If not specified, conmon defaults to the current working directory. The bundle is also used as the default location for the conmon debug log file (see Environment).

-r,  --runtime=PATH

Path to the OCI runtime binary used to manage the container (for example, /usr/bin/runc). This option is required for all modes other than --version​. The path must refer to an executable file; otherwise conmon fails with "Runtime path … is not valid".

--runtime-arg=ARG (multiple)

Additional argument to pass to the runtime for all operations. Can be specified multiple times. Values may begin with -​.

--runtime-opt=ARG (multiple)

Additional options passed to the runtime for restore or exec operations. Can be specified multiple times. Values may begin with -​.

--persist-dir=PATH

Persistent directory for the container. conmon writes exit status files here so higher-level tools can detect container exit using inotify or directory polling.

--socket-dir-path=PATH

Directory where attach sockets for the container are created. If not specified, defaults to /var/run/crio​.

--full-attach

Use the full path to the attach socket instead of truncating it based on --socket-dir-path​. When specified, conmon ignores --socket-dir-path for the attach socket path computation.

--sdnotify-socket=PATH

Path to the host's systemd sd-notify socket. When set, conmon relays sd-notify messages from the container to this socket.

--timeout,  -T=SECONDS

Kill the container after the specified timeout in seconds. If unset or 0, conmon does not impose a timeout on the container. Negative values are rejected.

--sync

Keep the main conmon process as the direct parent of the container by only forking once. This is mainly useful for debugging or special integration scenarios.

--syslog

Log to syslog. This is intended for use with the cgroupfs cgroup manager. It controls how conmon itself logs; it is distinct from the container log driver configured via --log-driver / --log-path​.

-s,  --systemd-cgroup

Enable systemd-based cgroup management instead of cgroupfs when launching or restoring a container. This is passed through as part of the runtime configuration.

--no-new-keyring

Do not create a new session keyring for the container.

--no-pivot

Disable pivot_root(2) and use alternative root switching mechanisms.

--replace-listen-pid

Replace an existing listen PID with the OCI runtime PID, when set. This is used by some higher-level integrations for PID tracking.

--stdin,  -i

Open a pipe to pass standard input to the container.

--terminal,  -t

Allocate a pseudo-TTY for the container's stdin/stdout/stderr.

PID files and exit handling

--conmon-pidfile,  -P=PATH

Write the PID of the conmon monitor process to the given file.

--container-pidfile,  -p=PATH

Write the PID of the initial process inside the container to the given file. If this option is not provided, conmon defaults to a file named pidfile-CID in the current working directory.

--pidfile=PATH (deprecated)

Deprecated PID file option kept for backward compatibility. Hidden from the built-in help output; prefer --conmon-pidfile or --container-pidfile instead.

--exit-dir=PATH

Path to the directory where exit files are written. These files allow higher-level tools such as Podman or CRI-O to detect container exit and read exit status.

--exit-command=PATH

Path to an external program to execute when the container terminates. The exit command receives arguments from --exit-command-arg and runs after exit files are written.

--exit-command-arg=ARG (multiple)

Additional argument to pass to the program specified by --exit-command​. May be specified multiple times. Values may begin with -​.

--exit-delay=SECONDS

Delay, in seconds, before invoking the exit command after container exit. The value must be greater than or equal to 0​.

Logging options

--log-level=LEVEL

Set the minimum log level for conmon's own debug logging (separate from container logs). The supported values follow the typical logging levels (for example, debug, info, warn, error); invalid values are treated according to the internal logger defaults.

--log-driver=NAME (multiple)

Select the container log driver. Preferred over the deprecated --log-path​. Can be specified multiple times. Dashes in the name are normalized to underscores (for example, k8s-file becomes k8s_file). Supported drivers:

  • file / k8s_file - File logging. Path is taken from --log-driver-opt path=... (k8s_file requires a path).
  • journald - Write container output to the systemd journal.
  • syslog - Write container output to syslog. Without --log-driver-opt syslog-address, messages go through openlog(3)/syslog(3) (process-global; only one such driver may be active). With syslog-address, messages are sent to a remote endpoint (see below).
  • none - Discard container output.
  • passthrough - Do not capture container output. The container inherits conmon's standard streams, and conmon does not create an attach socket. Cannot be combined with other drivers.

Cannot be combined with --log-path​. If neither --log-driver nor
 --log-path is provided, conmon exits with an error.

--log-driver-opt=KEY=VALUE (multiple)

Driver-specific option for --log-driver​. Can be specified multiple times. For file / k8s_file, use path=/path/to/logfile​. For syslog:

  • syslog-address - Remote destination. Supported forms: tcp://HOST[:PORT], udp://HOST[:PORT] (default port 514), unix:///PATH, unixgram:///PATH​. Omit the option for local openlog(3)/syslog(3); an empty value is an error.
  • syslog-facility - Facility name or number (for example daemon, user, local0, or 3). Defaults to user for local delivery and daemon for remote. Only facilities present on the portable syslog facility set are accepted.

TCP and UDP messages use RFC 5424. TCP prefixes each message with its
 octet count (RFC 6587). unix:// and unixgram:// follow Docker's
 traditional local layout: <PRI>, Go's time.Stamp, the tag, and the
 pid, then the line and a trailing newline. Those sockets have no
 octet-count prefix.

-l,  --log-path=SPEC (multiple)

Deprecated. Use --log-driver (and --log-driver-opt) instead. Legacy container logging destination. Can be specified multiple times. Each value has one of the following forms:

  • driver:path - Use the given driver and log to path​. Dashes in the driver name are normalized to underscores (for example, k8s-file becomes k8s_file).
  • journald - Use the journald driver.
  • passthrough - Use the passthrough driver (no additional file path).
  • none - Discard container output. null and off are accepted as legacy spellings of none​.
  • path - Any other non-empty value is treated as a file path for the default file driver.

Use --log-driver syslog for the syslog driver (not --log-path).
 Cannot be combined with --log-driver​.

--log-size-max=BYTES

Maximum size in bytes of a single container log file before rotation or truncation is considered. If unset or 0, there is no size-based limit. Negative values (including -1, the historical CRI-O default) also mean unlimited.

--log-global-size-max=BYTES

Maximum total size in bytes of all log files managed by the log driver. If unset or 0, there is no global size limit. Negative values (including -1) also mean unlimited.

--log-tag=STRING

Additional tag to include in log records.

--log-label=STRING (multiple)

Additional label to include in log records. Can be specified multiple times.

--log-allowlist-dir=PATH (multiple)

Allowed log directory. Can be specified multiple times. When set, the log driver restricts log writes to the given directories. If omitted, no allowlist restriction is applied.

--no-container-partial-message

Do not set CONTAINER_PARTIAL_MESSAGE=true for partial log lines when using the journald log driver. If specified with a non-journald driver, conmon logs a warning and the option has no effect.

--no-sync-log

Do not manually call sync on logs after container shutdown. This can improve performance at the cost of potentially losing log records in the event of a sudden system failure.

--log-rotate

Enable log rotation instead of truncation when --log-size-max is reached. Rotation requires --log-max-files to be at least 1.

--log-max-files=N

Number of backup log files to keep when rotation is enabled. The default is

 1.

The value must be non-negative; values greater than INT32_MAX are rejected. If --log-rotate is specified and --log-max-files is 0, conmon exits with "log-max-files must be at least 1 when log-rotate is enabled".

Exec and restore options

These options select and configure the exec and restore modes. They cannot be combined arbitrarily.

-e,  --exec

Exec a command into a running container, instead of creating a new container. When --exec is set:

--exec-process-spec=PATH

Path to the OCI process specification (typically a JSON file) describing the process to execute inside the container. Required when --exec is used. If missing, conmon exits with "Exec process spec path not provided. Use --exec-process-spec".

--exec-attach

Attach to an exec session. This option is only valid when --exec is also specified, and when --api-version is at least 1. If used without --exec, conmon fails with "Attach can only be specified with exec". If used with --api-version less than 1, conmon fails with "Attach can only be specified for a non-legacy exec session".

--restore=PATH

Restore a container from a previously created checkpoint at the specified path. When --restore is used:

--restore-arg=ARG (deprecated, multiple)

Additional argument to pass to the restore command. Deprecated and hidden from the built-in help, but still parsed for backward compatibility. Values may begin with -​.

Attach and I/O behavior

--leave-stdin-open

Leave standard input open when the attached client disconnects, instead of closing the container's stdin.

Mode selection summary

conmon selects its internal command mode based on the provided options:

Environment

The following environment variables affect conmon's own debug logging. They do not control the container log driver, which is configured via --log-driver (or deprecated --log-path) and related CLI options.

CONMON_LOG_PATH

Path to the debug log file for conmon itself. If not set, and --bundle is provided, conmon defaults to writing its debug log to BUNDLE/conmon-debug.log​. If neither CONMON_LOG_PATH nor --bundle is set, no debug log file path is configured.

CONMON_LOG_LEVEL

Minimum log level for conmon's internal debug logging. If not set or set to an invalid value, conmon defaults to a debug-level log filter.

Exit Status

On success, conmon exits with the exit status of the container or exec process, depending on the active mode. On internal errors (invalid arguments, runtime failures, logging misconfiguration, and similar), conmon prints an error message of the form:

conmon: MESSAGE

and exits with an appropriate non-zero status code.

In all normal cases, conmon:

Examples

Create and run a container using an OCI bundle in the current directory, logging to a file:

conmon \
  --cid mycid \
  --cuuid 123e4567-e89b-12d3-a456-426655440000 \
  --runtime /usr/bin/runc \
  --log-path /var/log/containers/mycid.log

Exec a process in a running container with attach, using API version 1 and a process spec:

conmon \
  --cid mycid \
  --cuuid 123e4567-e89b-12d3-a456-426655440000 \
  --runtime /usr/bin/runc \
  --api-version 1 \
  --exec \
  --exec-process-spec /run/mycid/exec-spec.json \
  --exec-attach \
  --log-path passthrough

Restore a container from a checkpoint with systemd cgroups enabled:

conmon \
  --cid mycid \
  --cuuid 123e4567-e89b-12d3-a456-426655440000 \
  --runtime /usr/bin/runc \
  --restore /var/lib/checkpoints/mycid \
  --systemd-cgroup \
  --log-path file:/var/log/containers/mycid.log

See Also

runc(8), podman(1), crio(8)