Wordpress PVC mouting issue lost+found in kubernetes

6/14/2019

i am using GKE kubernetes cluster and created the wordpress docker image.

Docker file:

FROM wordpress:php7.1-apache
COPY /web /var/www/html
RUN ls
WORKDIR /var/www/html
EXPOSE 80

Deployment.yaml

volumeMounts:
        - name: wordpress-content-data
          mountPath: /var/www/html/

When i try to mount a pvc with this docker image all the data inside it going empty and folder 'lost+found' added to path. i want all the data inside 'html' folder in PVC and also when new deployment come of wordpress data should be there only changed filer will overwrite.

i am also thinking to add CI/CD for docker image so please suggest answer to resolve this issue.

-- Harsh Manvar
docker
docker-compose
google-cloud-platform
kubernetes

2 Answers

6/25/2019

My mistake was in Dockerfile

Working dockerfile is like

FROM wordpress:php7.1-apache
COPY /web /usr/src/wordpress
WORKDIR /var/www/html
EXPOSE 80

have to use this path /usr/src/wordpress instead /var/www/html

GitHub documentation: https://github.com/docker-library/wordpress/tree/master/php7.1/apache

Docker-hub documentation : https://hub.docker.com/_/wordpress/

-- Harsh Manvar
Source: StackOverflow

6/24/2019

There are plenty of good articles, describing how to configure and deploy wordpress on GKE with data persistence.

Deploying WordPress and MySQL with Persistent Volumes on GKE works fine. You can use this manual as an example of successful installation.

-- VKR
Source: StackOverflow