<p>The closest answer I found is <a href="https://stackoverflow.com/questions/45928798/docker-volume-vs-kubernetes-persistent-volume-for-databases">this</a>.</p>

<p>But I want to know is that, will the Dockerfile VOLUME command be totally ignored by Kubernetes? Or data will be persisted into two places? One for docker volume (in the host which pod running) and another is Kubernetes's PV?</p>

<p>The reason of asking this is because I deploy some containers from docker hub which contain VOLUME command. Meanwhile I also attach PVC to my pod. I am thinking whether local volume (docker volume, not K8 PV) will be created in the node? If my pod scheduled to another node, then another new volume created? </p>

<hr>

<p>On top of this, thanks for @Rico to point out that <code>-v</code> command and Kubernetes's mount will take precedence over dockerfile VOLUME command, but what if as scenario below:</p>

<ul>
<li><p>dockerfile VOLUME onto '/myvol'</p></li>
<li><p>Kubernetes mount PVC to '/anotherMyVol'</p></li>
</ul>

<p>In this case, will <code>myvol</code> mount to my local node harddisk? and cause unaware data persisted locally?</p>

Sam YC
<p>It will not be ignored unless you override it on your Kubernetes pod spec. For example, if you follow <a href="https://docs.docker.com/engine/reference/builder/#volume" rel="noreferrer">this</a> example from the Docker documentation:</p>

<pre><code>$ docker run -it container bash
root@7efcf5ef12a2:/# mount | grep myvol
/dev/nvmeXnXpX on /myvol type ext4 (rw,relatime,discard,data=ordered)
root@7efcf5ef12a2:/#
</code></pre>

<p>You'll see that it's mounted on the root drive of the host where the container is running on. Docker actually creates a volume on the host filesystem under <code>/var/lib/docker/volumes</code> (<code>/var/lib/docker</code> is your Docker graph directory):</p>

<pre><code>$ pwd
/var/lib/docker/volumes
$ find . | grep greeting
./d0bc20d085243c39c4f386dce2f6cafcd8146128d6b0c8f9dcb27cfb61a7ecab/_data/greeting
</code></pre>

<p>You can override this with the <a href="https://docs.docker.com/storage/volumes/" rel="noreferrer"><code>-v</code></a> option in Docker:</p>

<pre><code>$ docker run -it -v /mnt:/myvol container bash
root@1c7211cf43d0:/# cd /myvol/
root@1c7211cf43d0:/myvol# touch hello
root@1c7211cf43d0:/myvol# exit
exit
$ pwd # &lt;= on the host
/mnt
$ ls
hello
</code></pre>

<p>So on Kubernetes you can override it in the pod spec:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
  - name: mycontainer
    image: container
    volumeMounts:
    - name: storage
      mountPath: /myvol
  volumes:
    - name: storage
      hostPath:
        path: /mnt
        type: Directory
</code></pre>
