wordpress
wordpress copied to clipboard
DOCS: Upgrade gudiance?
I am new to wordpress, very familiar with docker containers / compose / stacks etc.
I got my WordPress network-multisite install running on docker, its served by an nginx reverse proxy. Got all that working (though docs could be better because as there too many contradictory, invalid or just outdated blog posts on docker-wordpress+nginx)
My www, plugins and themes are all mounted as a bind mount from my host via the volume directive in compose
volumes:
- /mnt/iscsi/docker/wordpress/www:/var/www/html
When I choose to update to from 5.8.x to 5.9 is the right way to run the upgrade inside the container or pull the 5.9 image and do docker-compose down then up?
for reference, my full stack
version: '3'
services:
db:
image: mysql:5.7
volumes:
- /mnt/iscsi/docker/wordpressdb_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: xxxxxx
MYSQL_DATABASE: wordpressdb
MYSQL_USER: xxxxx
MYSQL_PASSWORD: xxxxxx
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
wordpress:
image: wordpress:latest
ports:
- 8080:80
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: xxxxxx
WORDPRESS_DB_PASSWORD: xxxxxxxx
WORDPRESS_DB_NAME: wordpressdb
volumes:
- /mnt/iscsi/docker/wordpress/www:/var/www/html
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
volumes:
db_data:
I would suggest updating both the image and the software, but the official recommendation is definitely to use the built-in updater, especially for (automatically) applying security updates.
If you're updating a major version, you'll likely want the newer base image just to make sure you catch newer required/recommended PHP modules, such as #688, but it's not usually strictly required. Another good reason to be updating your base image, however, is to make sure you're getting security updates at that layer as well, such as updates to PHP itself or packages from the underlying distribution.
(Yes, I agree this should be better documented :sweat_smile:)
With a mounted volume on /var/www/html
you will find that you can only update the Wordpress software by running a Wordpress upgrade or having it auto update. In fact, even without one, because of the VOLUME
directive in the Dockerfile you can only upgrade this way (even if you have a newer base image) unless you delete the volume or the Wordpress files in the volume. Quite a head scratcher for lots of people.
With a mounted volume on /var/www/html you will find that you can only update the Wordpress software by running a Wordpress upgrade or having it auto update. In fact, even without one, because of the VOLUME directive in the Dockerfile you can only upgrade this way (even if you have a newer base image) unless you delete the volume or the Wordpress files in the volume.
https://github.com/docker-library/docs/pull/2057 (and docs on Docker Hub):
The default configuration for this image matches the official WordPress defaults in which automatic updates are enabled (so the initial install comes from the image, but after that it becomes self-managing within the
/var/www/html/
data volume).
Related discussions & comments: https://github.com/docker-library/wordpress/issues/246#issuecomment-340557707, https://github.com/docker-library/wordpress/issues/520, https://github.com/docker-library/wordpress/issues/567#issuecomment-785401097
Is there an answer for this? The updater doesnt work because then it asks for FTP information. It seems really weird that i've been looking online for an answer for this for about 4hrs. Why doesnt Wordpress give a clear answer?
"How do we update docker containers without the need for the FTP functionality"
If WordPress is prompting you for FTP credentials, you need to fix your local permissions such that the user inside the container has permission to write to the files in your volume/mount.
If WordPress is prompting you for FTP credentials, you need to fix your local permissions such that the user inside the container has permission to write to the files in your volume/mount.
thank you very much. i would have never considered to search in this direction.
from 5.2 to 5.9 the application could update by it self, (excpt to 5.7 wich complete screwed it self to garbage) or by updating the image. but from 5.9 to 6.0.2 it showed me that weird ftp promt. i changed the permissions in /var/www/html volume to 0777 with owner www-data. and the update went trough without the promt. don't know why this is nessesary, i never changed anything in the permissions of that folder. the owner already was www-data and the rights were scattered between 0644, 0755 and 0777
If WordPress is prompting you for FTP credentials, you need to fix your local permissions such that the user inside the container has permission to write to the files in your volume/mount.
thank you very much. i would have never considered to search in this direction.
from 5.2 to 5.9 the application could update by it self, (excpt to 5.7 wich complete screwed it self to garbage) or by updating the image. but from 5.9 to 6.0.2 it showed me that weird ftp promt. i changed the permissions in /var/www/html volume to 0777 with owner www-data. and the update went trough without the promt. don't know why this is nessesary, i never changed anything in the permissions of that folder. the owner already was www-data and the rights were scattered between 0644, 0755 and 0777
i will try this thanks!
Closing, since I think https://github.com/docker-library/docs/pull/2057 is probably the best we're going to get here :sweat_smile: (it points out that the image has automatic updates enabled and explains how to not use that)