In IBM Cloud Pak for Integration (CP4I) v2021.2, which runs on Red Hat OpenShift, administrators often need to interact with running containers for troubleshooting, debugging, or configuration changes. The correct command to attach the shell to a running container is:
oc attach -c
This command connects the user to the standard input (stdin), output (stdout), and error (stderr) streams of the specified container inside a pod.
Alternatively, for interactive shell access, administrators can use:
oc exec -it -c -- /bin/sh
or
oc exec -it -c -- /bin/bash
if the container supports Bash.
A. run → ❌ Incorrect
C. connect → ❌ Incorrect
D. shell → ❌ Incorrect
OpenShift and Kubernetes do not have a shell command for connecting to a running container.
Instead, the oc exec command is used to start an interactive shell session inside a container.
Explanation of Incorrect Answers:
OpenShift CLI (oc) Command Reference
IBM Cloud Pak for Integration Troubleshooting Guide
Kubernetes attach vs exec Commands
IBM Cloud Pak for Integration (CP4I) v2021.2 Administration References:
Submit