Answers: <p>Kubernetes by default runs the command specified in container image. You can override that command using <code>command</code> and <code>args</code> in pod spec (see <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-pod" rel="nofollow noreferrer">doc</a>).</p>
  <p>So the only way to find the command is either to exec into the pod or inspect the container image.</p>
  
Answers: CC BY-SA 4.0
Answers: 2024-01-07T23:39:11.167Z
Answers: 2024-01-07T23:39:11.167Z
Answers: Vasilii Angapov
Body: <p>In Docker we can see the full command used to run a container using</p>
  <pre><code>docker ps --no-trunc
  </code></pre>
  <p>In case of containers inside pods in a Kubernetes cluster, how to find this same info?</p>
  <p>I also tried to describe a pod using <code>kubectl describe pods test-77f45b7bd7-hqvqh -n somenp</code> but it doesn't show that information:</p>
  <pre><code>Containers:
    data-exploration:
      Container ID:   docker://XXXXXXXXXXXXXXXXXXXXXXXXXX
      Image:          docker_uri
      Image ID:       docker-pullable://docker_uri
      Port:           3002/TCP
      Host Port:      0/TCP
      State:          Running
        Started:      Fri, 22 Dec 2023 10:37:25 +0000
      Ready:          True
      Restart Count:  0
      Limits:
        cpu:     1
        memory:  5Gi
      Requests:
        cpu:     500m
        memory:  1Gi
      Environment:
  </code></pre>
  
Tags: <docker><kubernetes>
Title: How to see the full command used to run a container in a Kubernetes pod?
UserDisplayName: Santhosh
ThreadText: # How to see the full command used to run a container in a Kubernetes pod?
  
  (Asked by: username_0 on 2023-12-25)
  
  In Docker we can see the full command used to run a container using
  
  ```
  docker ps --no-trunc
  
  ```
  
  In case of containers inside pods in a Kubernetes cluster, how to find this same info?
  
  I also tried to describe a pod using `kubectl describe pods test-77f45b7bd7-hqvqh -n somenp` but it doesn't show that information:
  
  ```
  Containers:
    data-exploration:
      Container ID:   docker://XXXXXXXXXXXXXXXXXXXXXXXXXX
      Image:          docker_uri
      Image ID:       docker-pullable://docker_uri
      Port:           3002/TCP
      Host Port:      0/TCP
      State:          Running
        Started:      Fri, 22 Dec 2023 10:37:25 +0000
      Ready:          True
      Restart Count:  0
      Limits:
        cpu:     1
        memory:  5Gi
      Requests:
        cpu:     500m
        memory:  1Gi
      Environment:
  
  ```
  
  **Tags:** docker, kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-07. Score: 0
  
  Kubernetes by default runs the command specified in container image. You can override that command using `command` and `args` in pod spec (see [doc](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-pod)).
  
  So the only way to find the command is either to exec into the pod or inspect the container image.
  
  
  ---
  
  