Build the yml file correctly

Installing a Joomla! brand new is great. But sometimes we have backups or sample folders of Joomla! to be installed locally. I’m looking for the correct way to build the docker-compose.yml file so that I can:

  • Do not download Joomla! and be able to use our files;
  • Being able to vary the version of php gradually in one direction or the other;
  • Access the database;
  • Use either a mysql 5, 8 or MariaDb 10 database

Thanks a lot for your help.

I’m not sure what “president” means in this context, but if it means forum owner or admin, I’m sure you understand the importance of choosing a good topic title. Please, edit your post and choose one that better describes your issue. I could change it, but I’m still trying to figure out the issue itself. What database Joomla supports has nothing to do with Docker. PHP is upgraded by building a new Joomla Docker image and recreating the container from it. You can also mount folders from the host where you can store data that you want to backup. Unless of course it is a database, when you probably want to use the recommended backup strategy by the database server documentation.

The description of the official image has different tags with different Jommla and php versions, it even shows an example for a compose file…
https://hub.docker.com/_/joomla

Furthermore, you might want to read this topic: Container Security & Encryption

Hello sorry it was just to introduce myself.

Maybe I’ll simplify my problem. I want to find out how to build my docker.compose.yml file so as not to use a Joomla! image. from hub.docker
I would like to be able to use my own Joomla! files. example with a quickstart > Helix Ultimate - Free Universal Joomla Template for any Website - JoomShaper
Or with a Joomla! backup file. in .jpa which we decompress with > Kickstart - Akeeba Ltd
Until now I use the method of installing a Joomla! new, then I replace the Joomla files with mine. But every time I get errors during installation every time.

This doesn’t really makes sense.

Either you are looking forward to

  • create your own image using a Dockerfile (you can base it on the official joomla-docker project and modify it for your needs)
  • or to use the official image and bind host folders into container folders to make the container use you local code instead

Though, isn’t the Joomla community a better place to discuss this sort of thing?

@magnytu2 You’re telling two different things.

By rephrasing your question, you’ve said something like “I wish to be able to use a specific version of PHP then install Joomla files myself”. The answer is: go to Docker, retrieve the desired PHP version (with Apache) and use that image. For instance the “php:8.3.4-apache” image

In your existing docker-compose.yml file (the one of Joomla) search the ìmage: item and replace the name to this one php:8.3.4-apache.

That said, you’ll then have a running Docker PHP 8.3.4 container without Joomla preinstalled.

And it will or won’t work because, perhaps, Joomla requires a few PHP modules that should be installed and enabled in the php.ini file. This is thus easier to not proceed like that in this context (your use case) but retrieve an existing Joomla image.

Let’s say: you wish to be able to install Joomla 4.3 and PHP 8.0 (because your current backup is using that specific J! version) ==> go to Docker Hub, search for the Joomla repository and, in the list of tags, try to retrieve that specific version. Here it is : “joomla:4.3-php8.0-apache” (Docker)

So if you’re a beginner, just reuse an existing Joomla image, don’t use an “empty” PHP one. You’ll have a lot of problems if you go in that direction.

For the database, back to the docker-compose.yml file you got on the Joomla repository. Replace the image name from MySQL to MariaDB, one version by another version but make sure Joomla supports that dbtype and that specific version.

You also mention “I got errors during the installation”. if those errors are related to Docker, please copy/paste them here.

1 Like

We can’t “build a docker-compose.yml” for a software we don’t know. It always depends on the software. The description of an image should contain how it can be used for development and production. That is indeed missing from the description of the official Joomla image. In this case, you know Joomla better than any of us probably, so if you know the folder structure, where the persistent data is stored, where the configuration files are, you are the best person to create the compose file and we can help with more specific Docker related questions.

On the other hand, even if someone knows the folder structure of the source code of a software, Linuc distributions or in this case image maintainers could organize the files differently and make using it for development (or production) harder or easier. At least when someone knows what to look for, it is easier to understand the changed structure. So if you needed to install Joomla in a Docker container and only after that add your own files, that could mean the image was not good enough or you don’t know how it should be used. I say it recently often, but bitnami images are sometimes better than official images. At least the bitnami Joomla image is better documented.

https://hub.docker.com/r/bitnami/joomla

It includes where you have to mount files, which you should do as @meyay already pointed out.

I also agree with @cavo789. Some images provide different variants to use different versions of the programming language or the underlying Linux distribution. When it is supported, you should upgrade and downgrade PHP versions that way. Make sure you mount only persistent data and some config files maybe so the source code can be changed. If you want the image for development, already built Joomla images could still be a good idea as you can be sure the most important requirements are installed. On the other hand, the official Joomla image description says this:

This image does not provide any additional PHP extensions or other libraries, even if they are required by popular plugins. There are an infinite number of possible plugins, and they potentially require any extension PHP supports. Including every PHP extension that exists would dramatically increase the image size.

If you need additional PHP extensions, you’ll need to create your own image FROM this one. The documentation of the php image explains how to compile additional extensions. Additionally, the joomla Dockerfile has an example of doing this.