The preferred content management system at Verge is the Joomla CMS. We have over 12 years experience working with Joomla and have written countless modifications, components, plugins and templates. Our traditional development process for a Joomla customization was to create a new user on our development VPS, install Joomla from source, set up the database and configure a temporary sub-domain for development. We would then SSH into the server and work directly on the files on the server, customizing the install as we were going along. Needless to say our development approach has changed over the years and one of the best improvements we have made is moving to a Docker based approach for our development. In this article I would like to give an illustrative example of how to easily use docker for your development work. This article assumes you have a basic understanding of what containers are and that they can be linked together to create infrastructure.
Step 1: Install Docker
First of all you will need to install Docker. You can get the relevant docker files from here https://www.docker.com/community-edition.
Step 2: Use a docker compose file to start your container
Next we will be using a docker compose file to set up our containers. If you need help on understanding the syntax of a docker compose file you can take a look here: https://docs.docker.com/compose/. A docker compose file basically sets up some basic parameters around your container and will let the two containers we will be using (joomla and the database) know on how to talk to each other. Below is an example compose file:
joomla: image: joomla links: - joomladb:mysql ports: - 8080:80 volumes: - ~/Work/Verge/joomla:/var/www/html joomladb: image: mysql:5.6 environment: MYSQL_ROOT_PASSWORD: example volumes: - ~/Work/Verge/joomla_mysql:/var/lib/mysql
Save the above content to a file called
docker-compose.yml. You will see an entry above that says
- ~/Work/Verge/joomla:/var/www/html and
- ~/Work/Verge/joomla_mysql:/var/lib/mysql. You will need to change that
~/Work/Verge/joomla location to a location on your own filesystem you can access to edit the code you are working on. This brings up the next step, how do you start the containers? All you need to do is run the following command from your terminal in the same directory as your
And you should see something like this in your terminal:
$ docker-compose up Creating verge_joomladb_1 Creating verge_joomla_1 Attaching to verge_joomladb_1, verge_joomla_1 joomladb_1 | Initializing database joomla_1 | Joomla not found in /var/www/html - copying now...
After a minute or two your containers should be up and running.
Completing the Joomla set up
All you need to do now is head to http://localhost:8080 and you should be seeing the standard installation screen. You are now able to access the files in the location you specified in your
The only thing that you may have noticed in your terminal are the instructions for connecting to the database:
You will need to use those credentials if you would like to connect to your database, otherwise Joomla will not install. If you are done with docker you can just close the terminal window that you ran
docker-compose up in and you should be all set. When you run the command again your site will once again be available at http://localhost:8080.