runtime
runtime copied to clipboard
Debug: Configuration driven method to access VM console for debug
Based on https://github.com/jcvenegas/cc-oci-runtime/commit/3334a2bc7c915e1f631bc85355f1ce20ea984200
We need to add cc-debug-console service to the image by default. Note: This will not be activated unless specified in the agent configuration
[Unit]
Description=Container debug console
[Service]
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
StandardInput=tty
StandardOutput=tty
PrivateDevices=yes
Type=simple
ExecStart=/usr/bin/bash
Activate the service using the agent running in the VM
Alternately modify the agent init file along the lines of
Description=Clear Containers Agent Target
Requires=basic.target
Requires=cc-agent.service
+Wants=cc-debug-console.service
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes
Then use the console use socat:
socat STATE_DIR_CONTAINER/console.sock -
where STATE_DIR_CONTAINER by default is /run/cc-oci-runtime/CONTAINER_ID .