<p>I want to run two different commands in two different location inside the kubernetes pod. How can I do it. My approach is below;</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: wso2is-deployment
  namespace: tech-ns
  labels:
    app: wso2is
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wso2is
  template:
    metadata:
      labels:
        app: wso2is
    spec:
      containers:
        - image: vialogic/wsois:cluster1.0
          name: wso2is
          imagePullPolicy: Always
          command: [&quot;/home/wso2carbon/wso2is-5.11.0/repository/resources/security/; /opt/java/openjdk/lib/security/&quot;, &quot;-c&quot;]
          args: [&quot;keytool -exportcert -alias wso2carbon -keystore wso2carbon.jks -rfc -file wso2carbon.pem; keytool -import -alias wso2Carbon -file wso2carbon.pem -keystore cacerts&quot;]
          resources:
            requests:
              memory: &quot;2Gi&quot;
              cpu: &quot;2000m&quot;
            limits:
              memory: &quot;4Gi&quot;
              cpu: &quot;4000m&quot;
                     volumeMounts:
              ...
</code></pre>
<p>let me explain you what I want to achieve in above manifest. I have two commands one <code>keytool -exportcert -alias wso2carbon -keystore wso2carbon.jks -rfc -file wso2carbon.pem</code> i want to execute this command on <code>/home/wso2carbon/wso2is-5.11.0/repository/resources/security/</code>, and the second command is <code>keytool -import -alias wso2Carbon -file wso2carbon.pem -keystore cacerts</code> in location <code>/opt/java/openjdk/lib/security/</code>.</p>
<p>When i apply the manifest it fail to create the container. when I describe the pod. it says.</p>
<pre><code>Message:      failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: exec: &quot;/home/wso2carbon/wso2is-5.11.0/repository/resources/security/; /opt/java/openjdk/lib/security/&quot;: stat /home/wso2carbon/wso2is-5.11.0/repository/resources/security/; /opt/java/openjdk/lib/security/: no such file or directory: unknown
</code></pre>

Feezan Khattak
<p>You want to pass your multiple commands as a shell script embedded in a call to <code>sh -c</code>, like this:</p>
<pre><code>command:
  - /bin/sh
  - -c
  - |
    cd /home/wso2carbon/wso2is-5.11.0/repository/resources/security/
    keytool -exportcert -alias wso2carbon -keystore wso2carbon.jks -rfc -file wso2carbon.pem

    cd /opt/java/openjdk/lib/security/
    keytool -import -alias wso2Carbon -file wso2carbon.pem -keystore cacerts
</code></pre>
<p>(Note that we're not using <code>args</code>.)</p>
<p>This will work, but it doesn't entirely make sense; the pod will exit as soon as these commands have completed. For a <code>Deployment</code>, you would typically expect to see your containers executing some sort of long-running command.</p>
