Skip to content
This repository has been archived by the owner on Mar 28, 2018. It is now read-only.

Debugging

James O. D. Hunt edited this page Nov 7, 2016 · 18 revisions

Runtime

To enable full debug for cc-oci-runtime when running under docker, follow the instructions below.

Note that enabling debug is slightly awkward in this scenario due to the fact that docker does not currently provide a way to pass extra command-line options to the runtime. To get around this restriction, the runtime provides a helper script called cc-oci-runtime.sh which reads extra arguments to pass to the runtime from /etc/cc-oci-runtime/cc-oci-runtime.sh.cfg on a normal system.

Specify an output directory

# Adjust directory as required
$ logdir=/tmp/cc-oci-runtime
$ sudo mkdir -p "$logdir"

Add debug options to configuration file

# Create the configuration directory
$ sudo mkdir -p /etc/cc-oci-runtime/

# Create the config file containing the extra command-line arguments to be
# passed to the real runtime.
$ cat << EOT | sudo tee -a /etc/cc-oci-runtime/cc-oci-runtime.sh.cfg
--debug
--global-log
$logdir/cc-oci-runtime.log
--hypervisor-log-dir
$logdir
EOT

Update docker service file to use helper script

Clear Linux

# Tell docker to run the helper script as the runtime.
# This script will launch the real runtime with the correct arguments.
$ sudo sed -i -e 's!/usr/bin/cc-oci-runtime!/usr/bin/cc-oci-runtime.sh!g' /lib/systemd/system/docker-cor.service

Other distributions

# Tell docker to run the helper script as the runtime.
# This script will launch the real runtime with the correct arguments.
$ sudo sed -i -e 's!/usr/bin/cc-oci-runtime!/usr/bin/cc-oci-runtime.sh!g' /etc/systemd/system/docker.service.d/clr-containers.conf

Apply changes

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker-cor

Generate debug output

With debug enabled, if you run, say:

$ docker run -ti busybox

... you should find the following files in /tmp/cc-oci-runtime/:

  • cc-oci-runtime.log
  • ${container}-hypervisor.stdout
  • ${container}-hypervisor.stderr

Note that the global log file is always appended to, so if you run docker run twice, you'll end up with output for both containers in the same file.

Further information

Full instructions on how to use the helper script are at the top of the script itself:

$ more /usr/bin/cc-oci-runtime.sh