How to locate and get into a task container on VMware Tanzu Application Service for VMs as root user
search cancel

How to locate and get into a task container on VMware Tanzu Application Service for VMs as root user

book

Article ID: 297996

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

For Long Running-Process (LRP), `cf ssh` provides the feature to login into the container for developers, platform operators can also login to container as root.

There is no `cf ssh` for task running on the platform. In some cases, operators need to investigate a problem with a stale task, for example, capture threaddump for a Java task process. This article explains steps how to login into task container as root user. 

 

Environment

Product Version: 2.7

Resolution

Prerequisite

  • cf CLI
  • jq utility

Instructions

  1. cf app APP_NAME --guid obtains the app_guid which is for running the task.
  2. cf curl /v3/apps/APP_GUID/tasks | jq '.resources[] | select(.state=="RUNNING") | .guid' returns the running task_guid.
  3. bosh ssh into any Diego Cell VM.
  4. cfdot task TASK_GUID | jq .cell_id returns the diego_cell GUID.
  5. bosh ssh diego_cell/CELL_GUID
  6. sudo -i
  7. /var/vcap/packages/runc/bin/runc --root /run/containerd/runc/garden exec -t TASK_GUID /bin/bash