6. Content Management Systems (CMS) - Mark-van-B/IT-Landscape-UCLL- GitHub Wiki

Introduction

CMS are tools that make it easy for users to change the content of a website without the need of technical skills (html/CSS/JavaScript, or any framework built around those).

In this example, I am going to use WordPress, simply because it's one of the most widely used examples out there.

Installation

Step 1: create an empty Wordpress container.

  • Open Docker Desktop, and click on >_ Terminal at the bottom of the window.

Screenshot 2025-05-31 110255

  • In it: write docker run --name <custom_name> -p <local_port you'd want to use, 8080:80 is fine> -d wordpress ( -d ="detach", which makes it run in the background, "wordpress" makes it a WordPress container)

Screenshot 2025-05-31 110334

  • Once it's all done, you'll have the WordPress container listed in the Containers tab of Docker Desktop:

Screenshot 2025-05-31 110538

  • From here, you could already go the Containers tab in Docker Desktop, expand the wordpress container, and click on the Port link to open it:

image

  • However, it'll quickly start asking about database details you won't have, so...

Step 2: include a database

  1. Open File Explorer, create a new folder somewhere, enter it, and rightclick -> New -> Text Document.
  2. Make sure that you can see the file extensions, here's where they hid the option in Windows 11:

image

  1. Rename "New Text Document.txt" to "compose.yaml" (see Docker Compose).
  2. Open it with Visual Studio Code, and paste the following text into it. Don't forget to save (Ctrl+S) afterwards!

services:
  wordpress:
    image: wordpress:latest
    ports:
      - "8000:80"
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: user
      WORDPRESS_DB_PASSWORD: password
      WORDPRESS_DB_NAME: wordpress
    volumes:
      - wordpress_data:/var/www/html

  db:
    image: mysql:5.7
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: user
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: rootpassword
    volumes:
      - db_data:/var/lib/mysql

volumes:
  wordpress_data:
  db_data:

NOTE: The database, user, and password need to be identical in both "environment: sections", but you are free to put whatever username/PW you want in there.

  1. No, really, don't forget to save! (Ctrl+ S))
  2. Open a Terminal (Right-click the Start Menu icon, choose "Run" from the menu, type cmd into it)

image

  1. Orient it towards the folder of compose.yaml:
  • Right click compose.yaml in the file explorer, copy as path

image

  • Go back to the Terminal, type cd (with a space after it), and right click in the Terminal to paste the filepath. Mine has a space between IT and Landscape, so I was forced to put the entire thing between double quotes.
  • Then run docker-compose up -d (the -d is optional, but it makes things run in the background)

Screenshot 2025-05-31 111622

Step 3: Enter the WordPress environment

  • Once that's all done, go back to localhost:8000 if the container is still running, otherwise redo the "docker run" command from above.
  • IF it asks for it: enter database host, database name, username, and password you specified in compose.yaml:

Screenshot 2025-05-31 111924

  • If not, just fill in the form with your username etc, and we're good to go!

image