# Issue with exec in container using Rancher API

**URL:** <https://forums.suse.com/t/issue-with-exec-in-container-using-rancher-api/36568>\
**Category:** SUSE Rancher Prime\
**Created:** [December 27, 2021, 4:22pm UTC](https://forums.suse.com/t/issue-with-exec-in-container-using-rancher-api/36568 "2021-12-27T16:22:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![QATest](https://avatars.discourse-cdn.com/v4/letter/q/59ef9b/32.png) [@QATest](https://forums.suse.com/u/QATest)\
**Post date:** [December 27, 2021, 4:22pm UTC](https://forums.suse.com/t/issue-with-exec-in-container-using-rancher-api/36568/1 "2021-12-27T16:22:39Z")

</div>

I need to run some commands in a container through Jenkins.  
I tried using the kubectl CLI, but it keeps timing out.

I am now trying to use the Rancher API. I’ve tried multiple options but cannot execute my command.  
This is the first command I’ve been trying:  
`curl -X POST "https://myrancher/k8s/clusters/clusterID/api/v1/namespaces/namespacename/pods/podID/exec?container=containername&stdout=true&stdin=true&stderr=true&tty=true" -H "command=powershell some commands" -H "Connection:upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits" -H "Sec-WebSocket-Key: $WebSocketKey" -H "Sec-WebSocket-Protocol: base64.channel.k8s.io" -H "Sec-WebSocket-Version: 13" -H "Accept-Encoding:gzip, deflate, br" -H "Authorization:Bearer $Rancher_Token"`

I am getting a weird response:  
3SW50ZXJuYWwgZXJyb3Igb2NjdXJyZWQ6IGVycm9yIGV4ZWN1

Any idea what might be happening?

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [December 27, 2021, 5:27pm UTC](https://forums.suse.com/t/issue-with-exec-in-container-using-rancher-api/36568/2 "2021-12-27T17:27:21Z")

</div>

This is a kubernetes api which has nothing specifically to do with Rancher… the first character is the kind of message, and the rest is base64 encoded. That says “Internal error occurred: error execu”.

---

<div class="post-metadata">

**Author:** ![QATest](https://avatars.discourse-cdn.com/v4/letter/q/59ef9b/32.png) [@QATest](https://forums.suse.com/u/QATest)\
**Post date:** [December 27, 2021, 5:46pm UTC](https://forums.suse.com/t/issue-with-exec-in-container-using-rancher-api/36568/3 "2021-12-27T17:46:22Z")

</div>

Is there a Rancher API I can use to execute something in a container?  
I did try ‘myurl ?action=execute’ but I’m getting `Invalid action: execute`

I am also trying the rancher cli  
rancher exec but I’m getting No help topic for ‘exec’
