diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-01-14 04:46:28 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-01-21 18:00:26 -0500 |
| commit | 97a9312c46513c842f1dfedfac7bfc4bbafdcb22 (patch) | |
| tree | 46d8c24bb47f33bed9bcc920020e6c9c18aeca7b | |
| parent | 2b1fa9e5a62f27186823539e748cc48718cd79e9 (diff) | |
| download | meta-virtualization-97a9312c46513c842f1dfedfac7bfc4bbafdcb22.tar.gz | |
vcontainer: add vshell command for VM debug access
Add vshell command to vdkr/vpdmn for interactive shell access to the
QEMU VM where Docker/Podman runs. This is useful for debugging container
issues directly inside the virtual environment.
Usage:
vdkr vmemres start
vdkr vshell
# Now inside VM, can run docker commands directly
docker images
docker inspect <image>
exit
The vshell command requires the memory-resident daemon to be running
(vmemres start). It opens an interactive shell via the daemon's
--daemon-interactive mode.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rwxr-xr-x | recipes-containers/vcontainer/files/vcontainer-common.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/recipes-containers/vcontainer/files/vcontainer-common.sh b/recipes-containers/vcontainer/files/vcontainer-common.sh index f10243f1..ddcb674f 100755 --- a/recipes-containers/vcontainer/files/vcontainer-common.sh +++ b/recipes-containers/vcontainer/files/vcontainer-common.sh | |||
| @@ -330,6 +330,7 @@ ${BOLD}${RUNTIME_UPPER}-COMPATIBLE COMMANDS:${NC} | |||
| 330 | ${CYAN}unpause${NC} <container> Unpause a container | 330 | ${CYAN}unpause${NC} <container> Unpause a container |
| 331 | ${CYAN}commit${NC} <container> <image> Create image from container | 331 | ${CYAN}commit${NC} <container> <image> Create image from container |
| 332 | ${CYAN}exec${NC} [opts] <container> <cmd> Execute command in container | 332 | ${CYAN}exec${NC} [opts] <container> <cmd> Execute command in container |
| 333 | ${CYAN}vshell${NC} Open interactive shell in VM (debug) | ||
| 333 | ${CYAN}cp${NC} <src> <dest> Copy files to/from container | 334 | ${CYAN}cp${NC} <src> <dest> Copy files to/from container |
| 334 | 335 | ||
| 335 | ${BOLD}Registry:${NC} | 336 | ${BOLD}Registry:${NC} |
| @@ -1565,6 +1566,25 @@ case "$COMMAND" in | |||
| 1565 | fi | 1566 | fi |
| 1566 | ;; | 1567 | ;; |
| 1567 | 1568 | ||
| 1569 | # VM shell - interactive shell into the VM itself (not a container) | ||
| 1570 | vshell) | ||
| 1571 | # Opens a shell directly in the vdkr/vpdmn VM for debugging | ||
| 1572 | # This runs /bin/sh in the VM, not inside a container | ||
| 1573 | # Useful for: | ||
| 1574 | # - Running docker commands directly to see full error output | ||
| 1575 | # - Debugging VM-level issues | ||
| 1576 | # - Inspecting the VM filesystem | ||
| 1577 | if ! daemon_is_running; then | ||
| 1578 | echo -e "${RED}[$VCONTAINER_RUNTIME_NAME]${NC} vshell requires daemon mode" >&2 | ||
| 1579 | echo "Start daemon with: $VCONTAINER_RUNTIME_NAME vmemres start" >&2 | ||
| 1580 | exit 1 | ||
| 1581 | fi | ||
| 1582 | |||
| 1583 | echo -e "${CYAN}[$VCONTAINER_RUNTIME_NAME]${NC} Opening VM shell (type 'exit' to return)..." >&2 | ||
| 1584 | RUNNER_ARGS=$(build_runner_args) | ||
| 1585 | "$RUNNER" $RUNNER_ARGS --daemon-interactive -- "/bin/sh" | ||
| 1586 | ;; | ||
| 1587 | |||
| 1568 | # Runtime cp - copy files to/from container | 1588 | # Runtime cp - copy files to/from container |
| 1569 | cp) | 1589 | cp) |
| 1570 | if [ ${#COMMAND_ARGS[@]} -lt 2 ]; then | 1590 | if [ ${#COMMAND_ARGS[@]} -lt 2 ]; then |
