data inside /var/www/html is getting override #724
Replies: 14 comments
-
If wordpress/latest/php8.1/apache/docker-entrypoint.sh Lines 28 to 37 in 1b78733 |
Beta Was this translation helpful? Give feedback.
-
@wglambert |
Beta Was this translation helpful? Give feedback.
-
I can't reproduce, what's it look like in your directory with a $ ls
index.php wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php
license.txt wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php
readme.html wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php
$ docker build . -t wordpress:test
Sending build context to Docker daemon 61.1MB
Step 1/2 : FROM wordpress
---> d4f1eb34e2f5
Step 2/2 : COPY . /var/www/html
---> 55b494682859
Successfully built 55b494682859
Successfully tagged wordpress:test
$ kubectl run --image=wordpress:test wordpress
pod/wordpress created
$ kubectl logs wordpress
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.42.0.9. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.42.0.9. Set the 'ServerName' directive globally to suppress this message
[Mon Feb 14 17:00:00.916325 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.51 (Debian) PHP/7.4.27 configured -- resuming normal operations
[Mon Feb 14 17:00:00.916858 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
$ kubectl exec -it wordpress -- bash
root@wordpress:/var/www/html# ls -l
total 216
-rw-r--r-- 1 root root 36 Feb 14 16:53 Dockerfile
-rw-r--r-- 1 root root 405 Feb 6 2020 index.php
-rw-r--r-- 1 root root 19915 Jan 1 00:15 license.txt
-rw-r--r-- 1 root root 7437 Dec 28 17:38 readme.html
-rw-r--r-- 1 root root 7165 Jan 21 2021 wp-activate.php
drwxr-xr-x 9 root root 4096 Feb 14 16:59 wp-admin
-rw-r--r-- 1 root root 351 Feb 6 2020 wp-blog-header.php
-rw-r--r-- 1 root root 2338 Nov 9 23:07 wp-comments-post.php
-rw-r--r-- 1 root root 3001 Dec 14 08:44 wp-config-sample.php
drwxr-xr-x 5 root root 4096 Feb 14 16:59 wp-content
-rw-r--r-- 1 root root 3939 Aug 3 2021 wp-cron.php
drwxr-xr-x 26 root root 12288 Feb 14 17:00 wp-includes
-rw-r--r-- 1 root root 2496 Feb 6 2020 wp-links-opml.php
-rw-r--r-- 1 root root 3900 May 15 2021 wp-load.php
-rw-r--r-- 1 root root 47916 Jan 4 08:30 wp-login.php
-rw-r--r-- 1 root root 8582 Sep 22 21:01 wp-mail.php
-rw-r--r-- 1 root root 23025 Nov 30 17:32 wp-settings.php
-rw-r--r-- 1 root root 31959 Oct 25 00:23 wp-signup.php
-rw-r--r-- 1 root root 4747 Oct 8 2020 wp-trackback.php
-rw-r--r-- 1 root root 3236 Jun 8 2020 xmlrpc.php |
Beta Was this translation helpful? Give feedback.
-
Yes if I run my custom docker image from docker then it works fine, there it doesn't install WordPress. However, if run the same image on Kubernetes then it installs the WordPress there. |
Beta Was this translation helpful? Give feedback.
-
This is my manifest file
|
Beta Was this translation helpful? Give feedback.
-
If I use the image in above manifest and deploy the WordPress then it install wordpress again there |
Beta Was this translation helpful? Give feedback.
-
Your volumeMounts:
- name: wordpress-vol
mountPath: /var/www/html And any reason for downloading https://wordpress.org/latest.tar.gz and hardcoding it in a Dockerfile when the Dockerfile already has it in wordpress/latest/php8.1/apache/Dockerfile Lines 124 to 131 in 1b78733 Also |
Beta Was this translation helpful? Give feedback.
-
Actually, I want to do CI/CD for Wordpress. If I don't download the wordpress and hardcore it, let's suppose I want to add a test.php file under /var/www/HTML. For that, I create a docker image from below Dockerfile
Then I deploy that docker image. Once the image got deployed then it again downloads wordpress itself then overridden the test.php because it doesn't find wordpress in the custom image. That's why I am downloading and hardcoding it in a docker file |
Beta Was this translation helpful? Give feedback.
-
wordpress/latest/php8.0/apache/Dockerfile Line 162 in 1b78733 You can put custom files into |
Beta Was this translation helpful? Give feedback.
-
Hi, @yosifkit, I tried adding a custom file into I added test.php there and created a docker image e.g. Now second time I created a docker image Does Wordpress only copy custom files only on the first empty start, not after that? |
Beta Was this translation helpful? Give feedback.
-
Yes, that's the intended design -- after the first start, it's intended that WordPress itself manage the installation (especially so it can perform automatic updates, which are almost always security related). |
Beta Was this translation helpful? Give feedback.
-
Ok, then how can we use WordPress images for CI/CD. |
Beta Was this translation helpful? Give feedback.
-
Use a fresh volume for each CI/CD run and you shouldn't have issues (or
save more specific locations like "wp-content").
|
Beta Was this translation helpful? Give feedback.
-
Yes if I don't use pvc with pods then every custom files is being copied from Is it with the wordpress docker image I need to use fresh volume for each CI/CD or with every docker image? I think it is with every docker image as we are updating new files directly to the docker image, not the pvc. |
Beta Was this translation helpful? Give feedback.
-
Hi There,
I am creating my own docker image from image
WordPress
When I run the custom image on Kubernetes, whatever I copied data in the docker image gets overridden.
If logs it shows
Beta Was this translation helpful? Give feedback.
All reactions