Here we will do the installation of our WordPress from Docker. This time we will be using Ubuntu, so installing Docker will be a little different than what we did on Oracle Linux, so it’s worth reviewing the Docker installation step.
Furthermore, we will have to install Portainer to manage our containers, and Nginx Proxy Manager to manage our sites.
We will do the installation in Docker, as we don’t want to dedicate this virtual machine only to our WordPress but we can use this instance for other applications.
WordPress but we can use this instance for other applications.
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
For Docker installation, you can follow the following steps:
# First we have to install some applications needed to run Docker:
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
# After that, we’ll have to download our gpg key to run the Docker:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
After that, we should download the Docker repository, where you will have all the necessary information to install Docker.
echo \
“deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Before doing any installation, we must update our library with the command:
sudo apt-get update
And finally, now we can install Docker.
sudo apt-get install docker-ce docker-ce-cli containerd.io
The easiest way to test if our Docker has been installed successfully, we’re going to install the most basic image possible, Hello Word:
sudo docker run hello-world
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
Now is the time to install our Portainer. First we will create our volume, for that use the command below:
sudo docker volume create portainer_data
To install the Portainer, use the command below:
sudo docker run -d -p 9000:9000 –name portainer –restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest -H unix:///var/run/docker.sock
– – – – – –
– – – – – – – – – – – – – – – – – – – – – – – – – – – – –
For more information about the NGINX Proxy manager, visit
the website:
https://nginxproxymanager.com/
To make life easier for everyone, check the NGINX Proxy
Manager Docker-compose below:
version: ‘3’
services:
app:
image: ‘jc21/nginx-proxy-manager:latest’
ports:
– ’90:80′
– ’81:81′
– ‘450:443’
environment:
DB_MYSQL_HOST: “db”
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: “npm”
DB_MYSQL_PASSWORD: “npm”
DB_MYSQL_NAME: “npm”
volumes:
– ./data:/data
– ./letsencrypt:/etc/letsencrypt
db:
image: ‘yobasystems/alpine-mariadb’
environment:
MYSQL_ROOT_PASSWORD: ‘npm’
MYSQL_DATABASE: ‘npm’
MYSQL_USER: ‘npmk’
MYSQL_PASSWORD: ‘npm’
volumes:
– ./mysql:/var/lib/mysql
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
Now is the time to install WordPress. To learn more about the installed image, check out the Link:
https://docs.docker.com/samples/wordpress/
The Docker-compose used was as follows:
version: “3.9”
services:
db:
image: lscr.io/linuxserver/mariadb
volumes:
– db_data:/config
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
– db
image: wordpress:latest
volumes:
– wordpress_data:/var/www/html
ports:
– “8000:80”
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {}
wordpress_data: {}
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
Pingback: Let's install WordPress on Docker using an instance on Oracle Cloud – Ubuntu 20.04 | Linux - OS of future
muito bom
Great, this has helped me get started with docker.
Thank you for your help