<p>I have create a docker image for my wordpress application with just this </p>

<pre><code>FROM wordpress:php7.4-apache
COPY . /var/www/html
</code></pre>

<p>after i have push my image on my private repo. When i run my new image the file of my custom wordpress are well in the <code>/var/www/html</code>.</p>

<p>but when i create a deploy in kubernetes with pvc my file on path /var/www/html is replace by the file from the wordpress:php7.4-apache image</p>

<p>i create my pvc like this </p>

<pre><code>    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: wp-pv-claim
      namespace: custom
      labels:
        app: wordpress
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 20Gi
</code></pre>

<p>and my deploy look like </p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: custom
  name: wordpress
  labels:
    app: wordpress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress
  template:
    metadata:
      labels:
        app: wordpress
    spec:
      containers:
        - image: privaterepo.azurecr.io/custom:latest
          name: wordpress
          env:
            - name: WORDPRESS_DB_HOST
              value: mysqlhost
            - name: DB_HOST
              value: mysqlhost
            - name: WORDPRESS_DB_USER
              value: mysqluser
            - name: DB_USER
              value: mysqluser
            - name: WORDPRESS_DB_PASSWORD
              value: mysqlpassword
            - name: DB_PASS
              value: mysqlpassword
            - name: WORDPRESS_DB_NAME
              value: dbname
            - name: DB_NAME
              value: dbname
            - name: WORDPRESS_TABLE_PREFIX
              value: wp
          ports:
            - containerPort: 80
              name: client
          volumeMounts:
            - name: wordpress-persistent-storage
              mountPath: /var/www/html
      volumes:
        - name: wordpress-persistent-storage
          persistentVolumeClaim:
            claimName: wp-pv-claim
</code></pre>

john
<p>Based on everything that was discussed in comments providing the answer for next generations :)</p>
<p>As per <a href="https://hub.docker.com/r/monachus/wordpress" rel="nofollow noreferrer">monachus/wordpress</a></p>
<blockquote>
<p>What's wrong with Wordpress's Docker image?</p>
<p>The container shipped by Wordpress copies over the contents of
/usr/src/wordpress to /var/www/html when the container is first
created, but only if no content already exists in /var/www/html. This
means that if you've already deployed the container and have a
persistent volume mounted at that location, you can upgrade your
container from 4.7.4 to 4.8.1, and although it claims to be 4.8.1,
nothing happens.</p>
</blockquote>
<p>Correct <code>Dockerfile</code> should contain <code>/usr/src/wordpress</code> path instead of <code>/var/www/html</code></p>
<pre><code>FROM wordpress:php7.4-apache
COPY . /usr/src/wordpress
</code></pre>
