Bobcares

Deploy Multiple WordPress Applications On Ubuntu – Using Docker

by | Jan 25, 2021

Wondering How to Deploy Multiple WordPress Applications On Ubuntu?

Docker is one of the most popular methods used to save, set up and share server environments using containers.

Containers allow to package up any application with all parts of it such as libraries and other dependencies and deploy it as one package.

Docker is designed in such a way to make it easier to create, deploy, and run applications with the help of containers.

At Bobcares, we often get requests from our customers to deploy multiple WordPress applications on Ubuntu servers.

Today let’s see the steps that our Support Engineers follow for the deployment of multiple WordPress Apps as a part of our Server Management Services.

 

How to Deploy Multiple WordPress Applications On Ubuntu 

In this article, we will be using the Docker Linux Container Engine to deploy multiple WordPress applications on Ubuntu. Docker uses containers to deploy applications in a hassle-free manner.

Deploy Multiple WordPress Applications On Ubuntu

 

Here we will be creating WordPress installed Docker images, which will allow us to run another WordPress site on any VPS, by a single command using Docker.

The steps that our Support Techs follow are given below:

 

Installing Docker on Ubuntu

1. We can use the following command to update the droplet and ensure aufs support is available.

$ sudo apt-get update
$ sudo apt-get -y upgrade
$ sudo apt-get install linux-image-extra-`uname -r`

2. Add the Docker repository key to apt-key for package verification with the command below:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

3. Next we can add the Docker repository to sources

$ sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"

4. Now we will update the repository first, with the following command:

$ sudo apt-get update

5. Finally, we will download and install Docker with the following command:

$ sudo apt-get install lxc-docker git

6. To enable forwarding with UFW we need to edit the UFW configuration:

$ sudo nano /etc/default/ufw

Replace:

DEFAULT_FORWARD_POLICY="DROP"

with:

DEFAULT_FORWARD_POLICY="ACCEPT"

7. Save and exit the configuration file.

8. Then reload UFW with the following command:

$ sudo ufw reload

9. To allow remote connections for using the docker daemon remotely we need to allow the default port of Docker which is 4243.

$ sudo ufw allow 4243/tcp

 

Some basic commands used for Docker

1. We can run the docker daemon with the following command:

$ sudo docker -d &

2. Client usage:

sudo docker [option] [command] [arguments]

It must be kept in mind that Docker requires sudo privileges to work as it uses sockets owned by root.

We can get a full list of all available commands by simply calling the client with the following command:

$ docker

 

Creating WordPress Containers

We will be using the out-of-the-box WordPress image ‘tutum/wordpress’.

In order to create containers from this image, we need to pull (download) it first using the following command:

$ docker pull tutum/wordpress

Once the image is ready, with a single command we can create dockerized WordPress instances.

1. To Create a Publicly Accessible WordPress Container

Run the following command to create a container that is reachable from the outside on a port we specify (e.g. 80):

$ docker run -p 80:80 tutum/wordpress

This command helps to create a WordPress instance that will accept connections from outside on the default HTTP port 80.

2. To Create a Locally Accessible WordPress Container

Run the following command to create a locally accessible container.

$ docker run -p 127.0.0.1::80 tutum/wordpress

Now Docker will create a container and provide its ID and then dynamically allocate a port.

We can find out which port the container is using with the port command given below:

docker port [container ID] [private port number]
$ docker port 9af15d56fdf8a587 80
# 127.0.0.1:49156

From the output, we can see that the container is accessible only on the localhost on port 49156.

We can use this address to redirect connections from a reverse-proxy using the following command:

docker run -p 127.0.0.1:[local port]:80 tutum/wordpress
$ docker run -p 127.0.0.1:9091:80 tutum/wordpress

Now the WordPress instance is locally accessible at port 9091.

[Need assistance to deploy your WordPress Apps? We are happy to help you!]

 

Conclusion

To conclude we saw how to deploy multiple WordPress applications on Ubuntu with Docker. Also, we saw the steps that our Support Engineers follow to do this easily.

Are you using Docker based apps?

There are proven ways to get even more out of your Docker containers! Let us help you.

Spend your time in growing business and we will take care of Docker Infrastructure for you.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF