+- My Board (https://ellohost.com/forum)
+-- Forum: Tutoriel EN (https://ellohost.com/forum/forumdisplay.php?fid=8)
+--- Forum: Wordpress (https://ellohost.com/forum/forumdisplay.php?fid=19)
+--- Thread: How to Install WordPress on Docker (Windows, macOS, and Linux) (/showthread.php?tid=146)
How to Install WordPress on Docker (Windows, macOS, and Linux) - aaron - 08-12-2023
How to Install WordPress on Docker (Windows, macOS, and Linux)
How to Deploy WordPress Image as a Docker Container
The following steps will show you how to install a WordPress content management system on a Docker container.
Step 1 – Install Docker
Docker is available for Windows, macOS, and Ubuntu. Here’s how you can install it on any of the three operating systems:
How to Install Docker on Ubuntu
In order to install Docker on a Linux VPS, you need to have a virtual private server (VPS) with one of the following operating systems:
Set up the repository: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update Docker’s repository: sudo apt-get update
Lastly, install the latest version of Docker Engine, containerd, and Docker Compose. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
To confirm that the installation process was successful, run the following command. The following success message should appear: sudo docker run hello-world
How to Install Docker on macOS
In order to install Docker on a macOS machine, these requirements must be met:
4 GB of RAM
macOS version 10.15 or newer
No previous versions of VirtualBox 4.3.30 can be installed
Here’s how you can install Docker on macOS:
Download Docker for Mac and double-click the .dmg file you’ve saved. Then, drag and drop the Docker icon into your Applications folder.
Open your Applications folder and double-click docker.app. During the configuration process, you’ll be asked to enter your password.
When prompted, Accept the service agreement; otherwise, the installation will fail.
Once the installation process is finished, you should see the Docker menu on your desktop’s status bar.
How to Install Docker on Windows
In order to install Docker Desktop on a Windows machine, these requirements must be met:
4 GB of RAM
64-bit processor from 2010 or more recent
Virtualization enabled in BIOS
Linux kernel update package installed if you are using the WSL 2 Docker back-end
Here’s how you can install Docker on Windows 10 64-bit:
Enable Hyper-V on your system.
Download Docker Desktop for Windows and open the Docker for Windows Installer file.
In the Configuration dialog window, check the boxes based on your preferences. Click Ok.
Once the installation is finished, click Close and restart and wait for your computer to reboot.
After reboot, Accept the service agreement, and Docker will be ready to use.
Step 2 – Set Up WordPress Container on Docker
In order to set up WordPress on Docker, two methods are available ‒ the CLI and Docker compose. In this tutorial, we will use the Docker compose method as it’s more straightforward and systematic.
It’s worth noting that all required images are acquired from Docker Hub:
WordPress – the official WordPress Docker image. Includes all WordPress files, Apache server, and PHP.
MySQL – required for MySQL root user, password, and database connection variables.
phpMyAdmin – a web application for managing databases.
Open your operating system’s preferred command line interface and check the Docker Compose Installation version: docker compose version
Create a new project directory for WordPress application with the following command: mkdir wordpress
Navigate to the new directory: cd wordpress
Using your preferred text editor, create a new docker-compose.yml file, and paste the contents below:
With the Docker Compose file created, run the following command in the same wordpress directory to create and start the containers: docker compose up -d
Step 3 – Complete WordPress Installation on a Web Browser
Open your browser and enter http://localhost:8000/. The WordPress setup screen will appear. Select the preferred language and continue.
Fill in your site name, username, password, and email.
When a Success! message pops-up, log in using your newly created details.
Lastly, you’ll be presented with the main WordPress dashboard screen.
Setting up phpMyAdmin
phpMyAdmin is a great tool for viewing and managing any existing databases. All you need to do is include these lines to an existing .yml file just after the services line along with the MySQL database service: