<p>I want to execute script before I run my container</p>
<p>If I execute script in container like that</p>
<pre><code>      containers:
        - name: myservice
          image: myservice.azurecr.io/myservice:1.0.6019912
          volumeMounts:
          - name: secrets-store-inline
            mountPath: &quot;/mnt/secrets-store&quot;
            readOnly: true
          command:
            - '/bin/bash'
            - '-c'
            - 'ls /mnt/secrets-store;'
</code></pre>
<p>then that command replaces my entrypoint and the pod exits. How can I execute command but then start the container after that</p>

Vladimir Bodurov
<p>A common way to do this is too use <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">Init Containers</a> but I'm unsure what you're trying to run before you run the <code>ENTRYPOINT</code>.</p>
<p>You can apply the same volume mounts in the init container(s), if the init work requires changing state of the mounted file system content.</p>
<p>Another solution may be to run the <code>ENTRYPOINT</code>'s command as the last statement in the script.</p>
