105Joomla - amagerard/Docker GitHub Wiki
1- Docker | 2- Firewall | 3- Portainer | 4- Drupal | 5- Joomla |
---|---|---|---|---|
6-Wordpress | 7-Xwiki | 8- Mediawiki | ||
Casaos | Zimaos |
Joomla is a Content Management System.
It is possible to create, manage and easily modify a website.
This procedure is based on this example.
Docker server ip :192.168.60.55/24
Your username: teacher
Your home directory:/home/teacher
Open Portainer for create network and volumes.
http://192.168.60.55:9000
Click on Environments Local.
- cnt_jla_wb_number.
- cnt_jla_db_number.
Containers will be created from the docker compose command line.
- net_jla_number.
Createnet_jla_1
.
Select Networks.
Add network.
Name : net_jla_1
Add Driver options:
Name : com.docker.network.bridge.name value : net_jla_1
Create the network.
Name: com.docker.network.bridge.name value : net_jla_1
is not specified, docker will give it a name as br-XXXX
.
- vol_jla_wb_number.
- vol_jla_db_number.
Create these volumes.
Select Volumes.
Add volume.
Name: vol_jla_wb_1
Create the volume.
Add the volume.
Name: vol_jla_db_1
Create the volume.
Command lines to create the netwok and volumes without portainer.
docker network create --opt com.docker.network.bridge.name=net_jla_1 net_jla_1
docker volume create vol_jla_wb_1
docker volume create vol_jla_db_1
chown -R www-dock:www-dock /var/lib/docker/volumes/vol_jla_wb_1
chown -R mysql-dock:mysql-dock /var/lib/docker/volumes/vol_jla_db_1
Logging with your username.
mkdir /home/teacher/joomla
vi /home/teacher/joomla/instance_joomla_1.yaml
# 2025, January
# replace number by 1 or 2 or ... until 9
# example n = 1
# port published wb = 8081
# port published db = 33771
# ip = 192.168.60.55
# your username is teacher
# you must create network net_jla_1 from portainer before installing joomla.
# you must create volume vol_jla_wb_1 from portainer before installing joomla.
# you must create volume vol_jla_db_1 from portainer before installing joomla.
# you must create php.ini file under /home/teacher/docker before installing joomla
#
# vi /home/teacher/docker/php.ini
# memory_limit = 500M
# upload_max_filesize = 500M
# post_max_size = 500M
# max_execution_time = 30
#
# you can modify /home/teacher/docker/php.ini but not delete it.
#
# Be careful with the tab, the indentation is 4 characters.
#
name: joomla_1 ## change n of joomla_n
services:
joomla:
cpu_shares: 90
command: []
container_name: cnt_jla_wb_1 ## change n of cnt_jla_wb_n
depends_on:
joomladb:
condition: service_started
restart: true
required: true
deploy:
resources:
limits:
memory: 2048M
environment:
- JOOMLA_DB_HOST=cnt_jla_db_1 ## change n to cnt_jla_db_n
- JOOMLA_DB_PASSWORD=password # change password as you want
hostname: cnt_jla_wb_1 ## change n to cnt_jla_wb_n
image: joomla:latest
links:
- joomladb:mariadb
ports:
- target: 80
published: '8081' ## change n of 808n
protocol: tcp
restart: always
volumes:
- /var/lib/docker/volumes/vol_jla_wb_1/_data:/var/www/html # create volume from portainer and change n of vol_jla_wb_n
- /home/teacher/docker/files/php.ini:/usr/local/etc/php/php.ini # create php.ini file before on /home/<username>/joomla
user: 2001:2001 ## www-dock gid ., Put '#' before the line for casaos or zimaos
devices: []
cap_add: []
network_mode: net_jla_1 # create network from portainer and change n of net_jla_1
privileged: false
joomladb:
cpu_shares: 90
command: []
container_name: cnt_jla_db_1 ## change n of cnt_jla_db_n
deploy:
resources:
limits:
memory: 2048M
environment:
- MYSQL_ROOT_PASSWORD=password # it is the same password JOOMLA_DB_PASSWORD
hostname: cnt_jla_db_1 ## change n of cnt_jla_db_n
image: mariadb:latest
ports:
- target: 3306
published: '33771' ## change n to 3377n
protocol: tcp
restart: always
volumes:
- /var/lib/docker/volumes/vol_jla_db_1/_data:/var/lib/mysql ## create volume from portainer and change n of vol_jla_db_n
user: 2002:2002 ## mysql-dock gid ., Put '#' before the line for casaos or zimaos
devices: []
cap_add: []
network_mode: net_jla_1 # create network from portainer and change n of net_jla_1
privileged: false
Certain parameters like Memory Limit, Upload_max_filesize, ... for joomla are defined in php.ini.
mkdir -p /home/teacher/docker/files
vi /home/teacher/docker/files/php.ini
memory_limit = 500M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 30
you can modify /home/teacher/docker/files/php.ini
but not delete it.
Installation.
docker compose -f /home/teacher/joomla/instance_joomla_1.yaml up
Crtl+C to stop.
Information.
If you want to change your joomla instance in 2
,
edit this file and replace _1
by _2
.
Then replace the port 8081
by 8082
and 33771
by 33772
.
On portainer, by default the volumes are marked Unused.
Open Portainer.
http://192.168.60.55:9000
Click on Environments Local.
Select Container cnt_jla_wb_1
.
Click on cnt_jla_wb_1
.
Click Duplicate/Edit
.
Advanced container settings
.
Click on Volumes
.
Volumes mapping.
Choose container /var/www/html
.
Click on Volume.
Select a Volume.
Choose vol_jla_wb_1 - local
.
Click on Deploy the container
.
Click on Replace
.
Select Container cnt_jla_db_1
.
Click on cnt_jla_db_1
.
Click Duplicate/Edit
.
Advanced container settings
.
Click on Volumes
.
Volumes mapping.
Choose container /var/lib/mysql
.
Click on Volume.
Select a Volume.
Choose vol_jla_db_1 - local
.
Click on Deploy the container
.
Click on Replace
.
Find your interface for network net_jla_1
.
The gateway is displayed in Portainer Networks.
Example:
The net_jla_1
gateway is 172.18.0.1/16
.
Network interface is net_jla_1
.
ifconfig
net_jla_1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255
ether 02:42:6a:71:3d:51 txqueuelen 0 (Ethernet)
RX packets 10742 bytes 23229052 (22.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12571 bytes 5854522 (5.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Add rules on firewall.
iptables -t nat -A POSTROUTING ! -o net_jla_1 -s 172.18.0.0/16 -j MASQUERADE
ufw route allow in on net_jla_1 out on eth0 to any from any
ufw allow in from any to any port 8081
The postrouting iptable rule disappears after restarting the server.
The solution is to add the rule in crontab.
Add postrouting iptable in /opt/docker/postrouting_sh
.
vi /opt/docker/postrouting_sh
.
iptables -t nat -A POSTROUTING ! -o net_jla_1 -s 172.18.0.0/16 -j MASQUERADE
Don't forget to delete line if you no longer use this iptable rule.
Information:
To delete an iptable postrouting rule without reboot.
Postrouting line number.
iptables --list -v --line-numbers -t nat
Remove rule ( 1 is the line number).
iptables -t nat -D POSTROUTING 1
http://192.168.60.55:8081
Select language : English
Setup Site Name : mybeautifulweb
Setup Login Data.
Enter the real name of your Super User: super master
set the username for your Super User account : supermaster
set the password for your Super User account (12 characters): as you want
Enter the email address of the website Super User: as you want
Setup data Base Connection.
Select the data base type: MySQLi
Enter the hostname, usually "localhost" or a name provided by your host: cnt_jla_db_1
Enter the database username you created or a username provided by your host : root
Enter the database password you created or a password provided by your host : password
Enter the database name: cnt_jla_db_1
Install Joomla.
Open administrator.
Login : supermaster
Password: your password
Joomla is ready.
To return to the administrator page.
http://192.168.60.55:8081/administrator