Start a Project

Dockerize Joomla : Virtualize your CMS within a light-weighted container

Why we need Docker Containers : Take A Quick Look 

Dependency hell is something that the application developers are dealing with for a very long time and what it means is, i build my application on my development machine, it works great, then i deploy my application to the production environment but it doesn’t work.

Hey developer, your application doesn’t work in our environment, fix it. Hey sysadmin, it works fine in my environment, why doesn’t it work in your environment? Therefore, it leaves system admin and developers pointing fingers at each other. Here, the concept of docker containers came into picture.

Containers are completely isolated environment.The application only needs to run inside the container which means that the operating system,underlying host and the environment that it runs on is completely abstracted from the application and therefore it successfully solves the problem of dependencies.

So if you are also dealing with such kind of problems within your content management system, this blog will definitely help you out. Here, we are taking joomla as a CMS which enables you to build websites and powerful online applications. Here we go !!

Understanding the scenario :

When using docker, we start with a base image. We boot it up, do changes and the changes are saved in layers forming another image. Basically, there are following two ways to create an image :-

Interactively, by running a shell from a base image and manually installing the required software.
Imperatively, by defining a series of commands inside a Dockerfile.
The first approach is undoubtedly better when experimenting or finding your feet, but when you want to start building reliable, reusable images I’ve found using a Dockerfile a must. So, we will go ahead with the latter one.

An instance of an image is called container. You have an image, which is a set of layers as you have described it by yourself. If you start this image, you have a running container of this image. You can have many running containers of the same image. To see all of your images and containers, run the following commands :-

 

Dockerfile of our base image : webkul/joomla

Pull our docker image for joomla directly from dockerhub using the following command :-

Check if you have successfully downloaded the image locally on your system :-

You must find webkul/joomla as an output of this command.

Run a container of this image using the following command :-

Note

No other services should be running on port 80 and 3306 of your host system. If so, change ports in the above docker command.

Access the URL to install joomla on your system :-

In order to access the credentials of your database, you have to get the container’s console. Run the following command :-

You are supposed to run “docker ps” to know container’s id before you run the above command.

Within container,read the content of the file named password.txt to access your mysql database username and password by running :-

Once your mysql username and password is known to you, you can simply login to mysql and create database accordingly.

For Reference :- https://hub.docker.com/webkul/joomla

For Source Code :-  https://github.com/webkul/docker_joomla

 

FOR ANY TYPE OF QUERY OR HELP, KINDLY CONTACT US

Exit mobile version