What is the CORRECT way to adjust php settings with the example Docker Compose deployment?

If one were to install Nextcloud with the ‘base version - apache’ example Docker Compose file at the official Nextcloud Docker repository, what is the officially recommended way to adjust things like “upload_max_filesize”, “max_input_time” or the PHP memory limit?

https://hub.docker.com/_/nextcloud

Hi warreng,

I had a look at the URL you posted and if I am not mistaken, you need to add the following two variables to the environment part of the docker compose file, to adjust the limits:

app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    environment:
      - PHP_MEMORY_LIMIT=1024M
      - PHP_UPLOAD_LIMIT=1024M
     ....

The value is just an example, since the default is 512M for both.

2 Likes

Ah, passing the values as environment variables does appear to work AND makes the most sense to me as the appropriate way to do this. And now that I look at the docker page again, I see that these variables are even spelled out for me! In the past I made the mistake of clicking the link that says “Check the Nextcloud documentation for more information.” This of course takes me to the standard docs which seem to assume that the user is not using docker-compose. I’m still often confused about why compose isn’t the default way to use docker for most applications…

Furthermore, when I’ve searched the interwebs about this topic I’ve found a few different suggestions for what seem like much more convoluted approaches. Things like adding a file (named “zzz-custom.ini” so that it loads last) to the conf.d folder.

Thanks for showing me the simple solution that was right in front of me!

No problem. Everyone had these days where they look through a documentation and misses the solution :slight_smile:

I think another approach could have been creating a local folder and create links in the docker-compose.yml to the config files in the container. So you could edit the configs locally and might just have to either restart the container or the containing service.

I am, however, not sure if there have been changes from Docker`s side regarding this.