<p>I am trying to make use of <code>amazon/aws-cli</code> docker image for downloading all files from s3 bucket through initcontainer and mount the same volume to the main container.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: test-deployment
  name: test-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-deployment
  template:
    metadata:
      labels:
        app: test-deployment
    spec:
      securityContext:
        fsGroup: 2000
      serviceAccountName: &quot;s3-sa&quot; #Name of the SA we ‘re using
      automountServiceAccountToken: true
      initContainers:
      - name: data-extension
        image: amazon/aws-cli
        volumeMounts:
          - name: data
            mountPath: /data
        command:
          - aws s3 sync s3://some-bucket/ /data
      containers:
      - image: amazon/aws-cli
        name: aws
        command: [&quot;sleep&quot;,&quot;10000&quot;]
        volumeMounts:
          - name: data
            mountPath: &quot;/data&quot;
      volumes:
        - name: data
          emptyDir: {}
</code></pre>
<p>But it does not seems working. It is causing init container to crashbackloop.
error:</p>
<pre><code>Error: failed to start container &quot;data-extension&quot;: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: &quot;aws s3 sync s3://some-bucket/ /data&quot;: stat aws s3 sync s3://some-bucket/ /data: no such file or directory: unknown
</code></pre>

Naveen Kerati
<p>Your <code>command</code> needs update:</p>
<pre><code>...
command:
- &quot;aws&quot;
- &quot;s3&quot;
- &quot;sync&quot;
- &quot;s3://some-bucket/&quot;
- &quot;/data&quot;
...
</code></pre>
