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 Jan 18, 2017 · 18 revisions

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.

# Adjust directory as required
$ logdir=/tmp/cc-oci-runtime
$ sudo mkdir -p "$logdir"
# 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
# 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!cor=cc-oci-runtime !cor=cc-oci-runtime.sh !g' /lib/systemd/system/docker.service
# 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!cor=cc-oci-runtime !cor=cc-oci-runtime.sh !g' /etc/systemd/system/docker.service.d/clr-containers.conf
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker-cor

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.

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

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