<p>i'm launching a glassfish pod on my Kubernetes cluster, and i'm trying to copy some .war files from a folder that's on my host, but the command cp always seems to fail.</p>

<p>my yaml file:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
 name: glassfish
spec:
# replicas: 2
 selector:
  matchLabels:
   app: glassfish
 strategy:
  type: Recreate
 template:
  metadata:
   labels:
    app: glassfish
  spec:
   containers:
   - image: glassfish:latest
     name: glassfish
     ports:
     - containerPort: 8080
       name: glassfishhttp
     - containerPort: 4848
       name: glassfishadmin
     command: ["/bin/cp"]
     args: #["/mnt/apps/*","/usr/local/glassfish4/glassfish/domains/domain1/autodeploy/"]
     - /mnt/apps/
     - /usr/local/glassfish4/glassfish/domains/domain1/autodeploy/
     volumeMounts:
     - name: glassfish-persistent-storage
       mountPath: /mount
     - name: app
       mountPath: /mnt/apps
   volumes:
   - name: glassfish-persistent-storage
     persistentVolumeClaim:
      claimName: fish-mysql-pvc
   - name: app
     hostPath:
      path: /mnt/nfs
      type: Directory</code></pre>
</div>
</div>
</p>

<p>I'm trying to use the following command in my container:</p>

<pre><code>cp /mnt/apps/* /usr/local/glassfish4/glassfish/domains/domain1/autodeploy
</code></pre>

<p>What am I doing wrong?</p>

<p>So far i've tried to do it with the /<em>, without it, using /*
When i use apps/</em> i see "item or directory not found", when i use apps/ i get "directory ommitted", i need only whats in the map, not the map itself so -r doesn't really help either.</p>

kubernoobus
<blockquote>
  <p>What am I doing wrong?</p>
</blockquote>

<p>here is correct command to execute:</p>

<pre><code>command: ["sh", "-c", "cp -r /mnt/apps/* /usr/local/glassfish4/glassfish/domains/domain1/autodeploy/ &amp;&amp; asadmin start-domain --verbose"]
</code></pre>

<p>With your cp command you effectively overwrite legitimate required command to start everything. You can see original one (running ok without your cp command) if you inspect that container. Initially, container is started with:</p>

<pre><code>...
"Cmd": [
    "/bin/sh", 
    "-c",
    "asadmin start-domain --verbose"
],
...
</code></pre>

<p>simply adding it after the copy command solves your issue.</p>
