It would be great if on https://hub.docker.com/_/wordpress/ there was a link to a step-by-step tutorial on how to get started with using this container image. (Or alternatively, a link / mention of another Docker image that might give you WordPress combined with MySQL - all ready to go.)
When I first saw this image on DockerHub, I thought maybe all I had to do was run the image and I'd have a working copy of WordPress I could experiment with. But then as I saw the "How to use this image" section, I realized that I needed to have a MySQL database running in a separate container. But now I need to figure out how to go and get that running, set up the appropriate users, etc.
It would be awesome if there was a step-by-step walk-through of all the steps you need to do to get this working as a WordPress instance running on your local machine.
I'm a long-time WordPress user but am newer to Docker. I was just thinking about firing up WP in a container to try out some of the WordPress 5.0 beta releases. Unfortunately I don't know all the steps to write the tutorial myself (although if I do go through the process I'll try to capture it all and document it as a tutorial).
A compose file is the simplest approach, and including the WORDPRESS_DB_ variables corresponding to the MYSQL_ ones will skip the database setup screen when going through the WordPress startup
version: '3'
services:
wordpress:
image: wordpress
container_name: wordpress
restart: always
volumes:
- ./wp-content:/var/www/html/wp-content
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wpdb
WORDPRESS_DB_USER: user
WORDPRESS_DB_PASSWORD: password
ports:
- 8080:80
- 443:443
db:
image: mysql:8
container_name: mysql
restart: always
command: "--default-authentication-plugin=mysql_native_password"
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wpdb
MYSQL_USER: user
MYSQL_PASSWORD: password
I came here to rant about poor documentation.
I lack step-by-step tutorial as well.
The biggest thing that seems to lose your attention is that https://hub.docker.com/_/wordpress/ provides not 1, but a SET of docker images, and they have different uses and they lack description completely.
I want wordpress based on php-fpm (instead of Apache), on Alpine Linux (instead of Debian) based and I want it to use php7.2 (rather than 5.*).
There is wordpress:php7.2-fpm-alpine image!
How to use?
All the docs are for wordpress image, which is wordpress:latest, which is Apache-based.
No, goddamn it, I want webserver (proxy) to work separately from php-fpm!
@wglambert - That's brilliant! Thanks so much. I copied that to my local system, tweaked it to have different passwords, did docker-compose up and... ta da... there it was! Thanks!
For the sake of completeness, I am documenting why @yosifkit closed this issue. A section has been added to:
https://github.com/docker-library/docs/tree/master/wordpress
that contains the YAML file from @wglambert above. This is now also visible at:
https://hub.docker.com/_/wordpress/
The section also has the relevant commands for docker stack and docker-compose.
This is helpful. I think there might be a way to make it even a bit easier to understand for a newcomer to Docker, and if I get the cycles to work on something I'll re-open this ticket and send in a pull request. Meanwhile, I'm glad to see it is up there.
Thank you for adding the text.