This is my final project to setup JOOMLA WebApp using Docker under the mentorship of Mr. VIMAL DAGA sir, under the campaign IIEC RISE.
- RedHat Enterprise Linux 8 , DOCKER software .
- Use
#systemctl start docker
.You need to start DOCKER because it is a PRODUCT . So, before using it,you need to start docker services.
- Pull MySQL image:
- Use
#docker pull mysql:5.7
to download mysql version 5.7 image to use as database server.
- Use
- Pull JOOMLA image:
- Use
#docker pull joomla:3.9-php7.2-apache
to download joomla image with php and apache web server already configured. - *to know more go to page: https://hub.docker.com/
- Use
- Use
#docker volume create <name of volume1>
. - Use
#docker run -dit -e MYSQL_ROOT_PASSWORD=<password of your root account> -e MYSQL_USER=<user name> -e MYSQL_PASSWORD=<password for user account> -e MYSQL_DATABASE=<name of folder inside MySQL which will be your database> -v <name of volume1>:/var/lib/mysql --name <hostname of container having mysql> mysql:5.7
. - To see databases created you need to install MySQL client which will send request to MySQL Server . For installing, use
#yum install mysql
.
- Use
#docker volume create <name of volume2>
. - Use
#docker run -dit -e JOOMLA_DB_HOST=<hostname of container having mysql> -e JOOMLA_DB_USER=<user name> -e JOOMLA_DB_PASSWORD=<password for user account> -e JOOMLA_DB_NAME=<name of folder inside MySQL which will be your database> -v <name of volume2>:/var/www/html --name <container name> -p <port no. of router i.e. exposed port>:<port no. of services running inside your server> --link <hostname of container having mysql> joomla:3.9-php7.2-apache
.
- Before using Docker-Compose you should install the software. For reference go to this website : https://docs.docker.com/compose/install/
- You can create and edit this file using vim editor. For that use
#vim docker-compose.yml
. Remember the file name should always be docker-compose.yml. You can change but, in later.
- We have copied entire infrastructure in one single file. Now it is ready to go !!! Now, you will come to know about the role of Docker. How it is so fast !!!
- Use
#docker-compose up
and#docker-compose down
to start and stop services respectively.
- There might be possible it is not able to connect that might be due to FIREWALL . Use
#systemctl stop firewalld
. Again you want to start the service use#systemctl start firewalld
. but, it is not good practice to stop firewall. Instead do this,- Masquerading allows for docker ingress and egress
#firewall-cmd --zone=public --add-masquerade --permanent
- Specifically allow incoming traffic on port 80/443 (nothing new here)
#firewall-cmd --zone=public --add-port=80/tcp
#firewall-cmd --zone=public --add-port=443/tcp
- Reload firewall to apply permanent rules
#firewall-cmd --reload
- Restart docker
#systemctl restart docker
- Masquerading allows for docker ingress and egress
- If JOOMLA WebApp is not opening on your desired port , maybe due to iptables . Use
#iptables -P FORWARD ACCEPT
.