I'm running a local Wordpress instance in a docker container build using wordpress latest image. According to Wordpress Site Health tool the REST API is not working. I get this error:
Error: cURL error 7: Failed to connect to localhost port 8000: Connection refused (http_request_failed)
My docker-compose looks like this
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {}
I tried also Bitnami image, but the effect is the same.
How can I get this working?
A friend solved this for me.
"8000:80"
in docker-compose.yml
to "80:80"
.docker volume ls
find volume namedocker volume rm <name>
in this case it's wordpress_db_data
You could probably also just update the settings in the Wordpress dashboard but installing it again seemed more convenient.
Now Wordpress Site Health should show no errors.