I’ve used Brad Traversy’s YT video ‘Quick Wordpress Setup With Docker’ to get a WP up and running (see code below). But there is still a lot I don’t understand. I’ve got my WP site up and running but I’ve got WP telling me there are updates available, before I ask my main question, I’d like to clear something up.
I’ve got a local folder which is mapped to another folder in the container and they sync up. Am I right in assuming that if WP updates (via my WP Admin console http://localhost:8000/wp-admin
), it’s actually updating my local folder, which in turn will update WP in the container since they are set up to sync with each other?
http://localhost:8000/
gives me access to the site.
Currently if I try to update this is what I see in the WP console
docker-compose.yaml ->
version: '3'
services:
####### Database service #######
db:
image: mysql:5.7
volumes:
# This gives us persistence
- db_data:/var/lib/mysql
# if the server reboots the container restarts
restart: always
# define your mysql environment variables
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- wpsite
####### phpmyadmin service #######
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '8080:80'
environment:
PMA_HOST: db
# as above in the db service
# your phymyadmin login is root/password
MYSQL_ROOT_PASSWORD: password
networks:
- wpsite
####### Wordpress service #######
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
# local:8000, container:80
- '8000:80'
restart: always
# okay so we want the WP install in the container to sync locally here
# Mapping './' (local current folder) to '/var/www/html' (container's web root folder as we're using apache)
volumes: ['./:/var/www/html']
environment:
# the host is going to be the db service by mysql above, port 3306 is the default for mysql
# we've already setup the DB user above
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- wpsite
# map the volume of db_data (in service db above) and the network of 'wpsite'
networks:
wpsite:
volumes:
db_data:
# Now go and run docker-compose up -d