If you work on Linux and cannot edit some of the project files right after the first installation, you can run the following command to set yourself as owner of the project files that were created by the Docker container:
docker compose run --rm php chown -R $(id -u):$(id -g) .See more in the TLS section
Remember that, by default, if you run docker compose up --wait,
only the files compose.yaml and compose.override.yaml will be used.
See "How Compose works"
and "Merge Compose files".
If you need to build images for production environment, you have to use the following command:
docker compose -f compose.yaml -f compose.prod.yaml build --pull --no-cacheBoth dev and prod images have the same image tag (<...>app-php:latest).
This can cause confusion when working with images.
It is important to make sure that your image is the appropriate one
for the current environment.
If you are not careful about this, and try to run your production container(s) with
docker compose -f compose.yaml -f compose.prod.yaml up --wait
without the right build process beforehand, your application will still launch,
but will be displaying an output of phpinfo()
(or possibly even a HTTP 500 error page).
See details below.
In the case of a dev image, you need the compose.yaml and
compose.override.yaml files, which are the default files for Docker Compose.
This means that running docker compose <command> or
docker compose -f compose.yaml -f compose.override.yaml <command> is the same thing.
In doing so, images frankenphp_base and frankenphp_dev are built,
but not frankenphp_prod, which is good enough for dev purposes.
Then, you can start your dev container(s) by running:
docker compose up --waitTo build the production image, you have to specify the compose.yaml and
compose.prod.yaml files.
This means you have to run the following command in order to build your image:
docker compose -f compose.yaml -f compose.prod.yaml build --pull --no-cacheWarning
The order of -f arguments matters.
That way, you will see that frankenphp_base and frankenphp_prod are built,
which is what you will need for production purposes.
You can finally start your prod container(s) by running:
docker compose -f compose.yaml -f compose.prod.yaml up --wait