Closed LVGDDesman closed 1 month ago
Because of how official images work and the compliance we need to adhere to, the images are built with hash validation for the files in the Joomla image folder. The /usr/src/joomla
Joomla folder is where the official Joomla files from the official release are placed, and this is managed through a hash validation process.
Now, obviously, once you've spun up the image, you're able to modify those files—especially if you mount them to your parent system. However, in a non-persistent container, the nature of the container makes it challenging to keep those files updated consistently.
Having said that, if you mount your Docker container to your parent system—for instance, mounting your /var/www/html
folder—Joomla currently behaves in a certain way when the container starts up. Mounting an external folder to the HTML folder requires a few important considerations.
First, the HTML folder must contain the unzipped Joomla package (from YooTheme). When the container starts up and detects that the files already exist in the /var/www/html/
folder, it will assume that this is not the first time the container is starting. As a result, it won't override the existing files; it will simply work with what's there, provided the files are unzipped. If the package is still in its zipped state, Joomla won't know how to handle it. This means you’ll need to unzip the package, and place it on your parent system in a location that you can mount into the Docker container at runtime, so it replaces the default HTML folder.
Now, there's a bit of a caveat here: the HTML folder has specific user permissions. By default, Joomla uses the internal www-data
user, but your parent system may have a different user with a different UID. This mismatch in permissions can prevent the internal Docker container from accessing the files due to permission issues.
Fortunately, there is a way around this. You can pass the external (i.e., parent system) user IDs to the container, allowing the container to take ownership of the files with the correct permission ID. I can provide you with a Docker Compose configuration to demonstrate what I mean. You can then attempt to get it working.
I use this method regularly for various deployments, and while it is indeed possible to override the HTML folder in the Joomla Docker container, it can be a bit technical. If just one small thing is out of place, it might seem like it's not working.
There are two potential resolutions:
So, here’s the Composer file I believe should do the job. Let me know if you can get it running.
First a traefik setup:
services:
traefik:
container_name: traefik
image: "traefik:latest"
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker
- --log.level=ERROR
- --certificatesresolvers.octoleoresolver.acme.httpchallenge=true
- --certificatesresolvers.octoleoresolver.acme.email=joomla@yourdomain.com
- --certificatesresolvers.octoleoresolver.acme.storage=/acme.json
- --certificatesresolvers.octoleoresolver.acme.httpchallenge.entrypoint=web
- --providers.file.directory=/conf
- --providers.file.watch=true
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/home/username/Docker/traefik/conf:/conf"
- "/home/username/Docker/traefik/acme.json:/acme.json"
labels:
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
networks:
- traefik
networks:
traefik:
external: true
name: traefik_webgateway
The Joomla Setup:
services:
mariadb_websitename:
image: mariadb:latest
container_name: mariadb_websitename
restart: unless-stopped
environment:
MARIADB_USER: octoleo
MARIADB_DATABASE: octoleo
MARIADB_PASSWORD: your_password_here
MARIADB_ROOT_PASSWORD: your_root_password_here
volumes:
- '/home/username/Projects/websitename/db:/var/lib/mysql'
networks:
- traefik
joomla_websitename:
image: joomla:5.1
container_name: joomla_websitename
restart: unless-stopped
environment:
APACHE_RUN_USER: "#1000"
APACHE_RUN_GROUP: "#1000"
JOOMLA_DB_HOST: mariadb_websitename:3306
JOOMLA_DB_USER: octoleo
JOOMLA_DB_NAME: octoleo
JOOMLA_DB_PASSWORD: your_password_here
depends_on:
- mariadb_websitename
volumes:
- '/home/username/Projects/websitename/website:/var/www/html'
networks:
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.joomla_websitename.rule=Host(`octoleo.yourdomain.com`)"
- "traefik.http.routers.joomla_websitename.entrypoints=websecure"
- "traefik.http.services.joomla_websitename.loadbalancer.server.port=80"
- "traefik.http.routers.joomla_websitename.service=joomla_websitename"
- "traefik.http.routers.joomla_websitename.tls.certresolver=octoleoresolver"
phpmyadmin_websitename:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin_websitename
restart: unless-stopped
environment:
PMA_HOST: mariadb_websitename
PMA_PORT: 3306
UPLOAD_LIMIT: 300M
depends_on:
- mariadb_websitename
networks:
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.phpmyadmin_websitename.rule=Host(`octoleo-db.yourdomain.com`)"
- "traefik.http.routers.phpmyadmin_websitename.entrypoints=websecure"
- "traefik.http.services.phpmyadmin_websitename.loadbalancer.server.port=80"
- "traefik.http.routers.phpmyadmin_websitename.service=phpmyadmin_websitename"
- "traefik.http.routers.phpmyadmin_websitename.tls.certresolver=octoleoresolver"
networks:
traefik:
external: true
name: traefik_webgateway
This is a very basic setup but should get you going...
So on your local (Parent System) /home/username/Projects/websitename/website
in the website folder you unzip the youtheme Zip package.
Also note the APACHE
user details:
APACHE_RUN_USER: "#1000"
APACHE_RUN_GROUP: "#1000"
That is the parent user-ID on Linux.
Thank you for the detailed info! Using your composefile it works instantly. :smile: (yootheme theme selectable in page creation, editable demo page, yootheme link in administration all present)
In my previous environment I was using a standard postgres instead of mariadb, which did not work as described in my previous comment:
services:
postgresql:
image: postgres:latest
hostname: postgres
restart: always
environment:
POSTGRES_DB: joomla
POSTGRES_USER: joomla
POSTGRES_PASSWORD: changeit
volumes:
- ./db:/var/lib/postgresql/data/
joomla:
image: joomla:latest
hostname: joomla
restart: always
environment:
JOOMLA_DB_HOST: postgres
JOOMLA_DB_USER: joomla
JOOMLA_DB_PASSWORD: changeit
JOOMLA_DB_NAME: joomla
JOOMLA_DB_TYPE: pgsql
ports:
- 180:80
volumes:
- ~/horizon/:/var/www/html
# ls -al horizon
total 120
drwxr-xr-x 17 www-data www-data 4096 Sep 13 10:01 .
drwx------ 17 root root 4096 Sep 13 10:09 ..
-rw-r--r-- 1 www-data www-data 18092 Jul 2 09:23 LICENSE.txt
-rw-r--r-- 1 www-data www-data 5275 Jul 2 09:23 README.txt
drwxr-xr-x 11 www-data www-data 4096 Sep 13 06:26 administrator
drwxr-xr-x 5 www-data www-data 4096 Sep 13 06:26 api
drwxr-xr-x 2 www-data www-data 4096 Sep 13 06:26 cache
drwxr-xr-x 2 www-data www-data 4096 Sep 13 06:26 cli
drwxr-xr-x 18 www-data www-data 4096 Sep 13 06:26 components
-rw-r--r-- 1 www-data www-data 2050 Sep 13 10:01 configuration.php
-rw-r--r-- 1 www-data www-data 6899 Jul 2 09:23 htaccess.txt
drwxr-xr-x 6 www-data www-data 4096 Sep 13 06:26 images
drwxr-xr-x 2 www-data www-data 4096 Sep 13 06:26 includes
-rw-r--r-- 1 www-data www-data 1060 Jul 2 09:23 index.php
drwxr-xr-x 4 www-data www-data 4096 Sep 13 06:26 language
drwxr-xr-x 6 www-data www-data 4096 Sep 13 06:26 layouts
drwxr-xr-x 6 www-data www-data 4096 Sep 13 06:26 libraries
drwxr-xr-x 75 www-data www-data 4096 Sep 13 06:26 media
drwxr-xr-x 27 www-data www-data 4096 Sep 13 06:26 modules
drwxr-xr-x 26 www-data www-data 4096 Sep 13 06:26 plugins
-rw-r--r-- 1 www-data www-data 764 Jul 2 09:23 robots.txt
drwxr-xr-x 5 www-data www-data 4096 Sep 13 06:26 templates
drwxr-xr-x 2 www-data www-data 4096 Sep 13 06:26 tmp
-rw-r--r-- 1 www-data www-data 2974 Jul 2 09:23 web.config.txt
I can edit my composefile/redo the joomla initialization to use mariadb. This resulted in the correct functionality so I guess (some) yootheme demo packages are just not compatible with postgres.
I hope this is the right place to ask. I'm trying to install a demo package obtained at yoothemes into this docker container.
Expected behavior:
What I've tried:
How do I add demo-packages to the docker container? Thanks in advance!