This is a diagram that I have used for this lab.
I have explained how to use Docker compose to deploy WordPress on-prem (https://tungle.ca/?p=2381). In this article, I will install docker on the Debian Linux instance on AWS, then deploy WordPress via this docker.
SSH to the machine.
sudo apt-get update
+ Install Docker CE on Debian 10.
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
+ Add Docker GPG key and Docker repository.
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
+ Install Docker Engine.
apt-get update
apt-get install docker-ce docker-ce-cli
+ Enable and start Docker daemon.
systemctl start docker
systemctl enable docker
systemctl status docker
+ Next, use Docker compose to deploy WordPress. Download the Latest Docker Version.
sudo su
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
+ Change file permission & check the docker version.
chmod +x /usr/local/bin/docker-compose
docker–compose -v
+ Create a sample docker-compose.yml file.
mkdir mywordpress
cd mywordpress/
nano docker-compose.yml
version: "3.9"
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: tungwordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- wordpress_data:/var/www/html
ports:
- "80:80"
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {}
wordpress_data: {}
+ Deploy WordPress by using Docker compose.
docker-compose up -d
+ Check that TCP port 80 is running on the docker node.
netstat -antp | grep 80
+ Access to WordPress.
+ Check the docker container is running.
docker-compose ps
docker-compose images