WordPress powers millions of websites worldwide, thanks to its flexibility and ease of use. Pairing it with Docker simplifies deployment, making it a breeze to set up and maintain. In this guide, we’ll walk you through installing WordPress on an Ubuntu machine using Docker.
Need a reliable server? Get started with a Hostomy Cloud Server
Docker enables you to run WordPress and its dependencies, such as MySQL, in isolated containers. This means:
Before starting, ensure you have:
If you don’t already have a server, choose a reliable one from Hostomy. Once your server is ready, log in via SSH:
ssh username@your_server_ip
Docker Compose simplifies managing multiple containers. Create a directory for your project and navigate to it:
mkdir wordpress-docker cd wordpress-docker
Then, create a docker-compose.yml
file:
nano docker-compose.yml
Add the following content:
version: '3.3' services: wordpress: image: wordpress:latest container_name: wordpress ports: - "8080:80" environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress_password WORDPRESS_DB_NAME: wordpress volumes: - wordpress_data:/var/www/html db: image: mysql:8.0 container_name: wordpress_db environment: MYSQL_ROOT_PASSWORD: root_password MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress_password volumes: - db_data:/var/lib/mysql volumes: wordpress_data: db_data:
This configuration sets up two services:
Run the following command to start the WordPress and MySQL containers:
docker-compose up -d
This will download the required images and start the containers in detached mode.
Once the containers are running, open a browser and visit:
http://your_server_ip:8080
You’ll see the WordPress setup wizard.
wordpress
wordpress
wordpress_password
db
Congratulations! Your WordPress site is now live.
docker ps
docker-compose down
docker-compose up -d
With WordPress running, you can:
For a seamless WordPress experience, choose a Hostomy Cloud Server. Our servers are optimized for speed, reliability, and scalability, making them ideal for Docker deployments.
Get started with Dockerized WordPress today and unleash the potential of your website! 🚀