Marinus Klasen

Marinus Klasen

  • Development
  • Consultancy
  • Developer Resources
  • Blog
  • Contact

April 18, 2022

Show the errors and notices from WordPress in Docker

Marinus Klasen

Another short, solution-minded blog post today!

In some cases I run the default WordPress Docker container. But, debugging is always well, a bit more complicated. We can enable WP_DEBUG_LOG by setting an environment variable: WORDPRESS_DEBUG_LOG

But how do you read, or even better, tail the debug.log file?

Run docker logs -f docker_container_name_or_id > /dev/null

The docker-compose.yml file

version: "3"

services:
  db:
    container_name: ${NAME}-db
    image: mariadb:10.8.2
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    volumes:
      - "./app/data/db:/var/lib/mysql"
    ports:
      - "3306"
    restart: unless-stopped

  wordpress:
    container_name: ${NAME}-wordpress
    image: "wordpress"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik_proxy"
      - "traefik.http.routers.${NAME}.rule=Host(`${SITE_DOMAIN}`)"
      - "traefik.http.routers.${NAME}.tls=true"
    volumes:
      - "./app/www:/var/www/html/"
    links:
     - db

networks:
  default:
    external:
      name: traefik_proxy%

The .env file

NAME=third-test
SITE_DOMAIN=third-test.c7

WORDPRESS_ENV=development
DB_NAME=wordpress
DB_USER=wordpress
DB_PASSWORD=password
MYSQL_PASSWORD=password
DB_HOST=db

WP_DEBUG=true
WP_DEBUG_DISPLAY=true
WP_DEBUG_LOG=true

WP_HOME=https://third-test.c7
WP_SITEURL=https://third-test.c7
The command for tailing logs

docker logs -f third-test-wordpress > /dev/null

Happy debugging!

About Marinus Klasen

Marinus has been working in software/web development for more than a decade. Since 2020 his attention shifted on sharing knowledge and developing products and tools for sharing knowledge.

Marinus Klasen on Twitter

Looking for a WordPress expert?
Hire top notch developers on Codeable!

Consult an expert

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get in touch

Contact me using the details below

Marinus Klasen

Wilhelmina van Pruisenweg 35, 2595 AN Den Haag

marinus@mklasen.com
twitter.com/marinusklasen
linkedin.com/in/marinusklasen

  • GitHub
  • LinkedIn
  • Twitter

Have you read?

  • Elementor Widget UsageMarch 27, 2025
  • Programmatically showing popups with ElementorMarch 25, 2025
  • The Elementor sanitize_settings errorSeptember 12, 2024
  • Announcing.. Wooping Shop Health!June 13, 2024
  • Swiper setup when using wp-scriptsMarch 14, 2024

Copyright © 2025 ยท Marinus Klasen | Webdesign by Team Rood