<p>I have a script that uses curl and that script should be run in Kubernetes agent on Jenkins. Here is my original agent configuration:</p>
<pre><code>    pipeline {
        agent {
        kubernetes {
            customWorkspace 'ng-cleaner'
            yaml &quot;&quot;&quot;
kind: Pod
metadata:
spec:
  imagePullSecrets:
    - name: jenkins-docker
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
              - key: agentpool
                operator: In
                values:
                  - build
  schedulerName: default-scheduler
  tolerations:
    - key: type
      operator: Equal
      value: jenkins
      effect: NoSchedule
  containers:
    - name: jnlp
      env:
        - name: CONTAINER_ENV_VAR
          value: jnlp
    - name: build
      image: tixartifactory-docker.jfrog.io/baseimages/helm:helm3.2.1-helm2.16.2-kubectl.0
      ttyEnabled: true
      command:
        - cat
      tty: true
&quot;&quot;&quot;
        }
    }
</code></pre>
<p>The error message is &quot;curl ....
/home/jenkins/agent/ng-cleaner@tmp/durable-0d154ecf/script.sh: 2: curl: not found&quot;</p>
<p>What I tried:</p>
<ol>
<li>added shell step to main &quot;build&quot; container:
shell: sh &quot;apk add --no-cache curl&quot;, also tried &quot;apt install curl&quot;- didn't help</li>
<li>added new container with curl image:
- name: curl
image: curlimages/curl:7.83.1
ttyEnabled: true
tty: true
command:
- cat - didn't help as well</li>
</ol>
<p>Any suggestions on how I can make it work?</p>

user15824359
<p>I resolved it.
It was needed to add shell step to main container:</p>
<pre><code>shell: sh &quot;apk add --no-cache curl&quot;
</code></pre>
<p>and then place my script inside container block:</p>
<pre><code>stages {
    stage('MyStage') {
        steps {
            container('build'){
                script {
</code></pre>
