nextcloud / docker

⛴ Docker image of Nextcloud
https://hub.docker.com/_/nextcloud/
GNU Affero General Public License v3.0
5.98k stars 1.82k forks source link

PHP_MEMORY_LIMIT environment variable seems to get ignored #2251

Closed nenatap closed 3 months ago

nenatap commented 3 months ago

As stated on https://hub.docker.com/_/nextcloud , one should be able to modify the php memory limit by setting environment variable PHP_MEMORY_LIMIT.

It looks like the value is ignored, or overwritten somewhere. Here is my docker compose file for the nextcloud:

  app:
    image: nextcloud:29.0.2-apache
    container_name: nextcloud-app
    networks:
     - nextcloud_network
    environment:
     - MYSQL_HOST=nextcloud-mariadb:3306
     - MYSQL_PASSWORD=*REDACTED*
     - MYSQL_DATABASE=maria
     - MYSQL_USER=maria
     - VIRTUAL_HOST=nextcloud.example.com
     - VIRTUAL_PATH=/
     - LETSENCRYPT_HOST=nextcloud.example.com
     - LETSENCRYPT_EMAIL=administrator@example.com
     - LETSENCRYPT_TEST=false
     - PHP_MEMORY_LIMIT=1024M
    depends_on:
     - letsencrypt
     - proxy
     - db
    volumes:
     - nextcloud:/var/www/html
     - ./app/config:/var/www/html/config
     - ./app/custom_apps:/var/www/html/custom_apps
     - ./app/data:/var/www/html/data
     - ./app/themes:/var/www/html/themes
     - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

volumes:
  nextcloud:
  db:
networks:
  nextcloud_network:

And when testing, here are the results:

root@ubuntu-4gb [bash]:~/nextcloud#>docker compose restart
Container nextcloud-mariadb      Started
Container nextcloud-app          Started
Container nextcloud-letsencrypt  Started
Container nextcloud-proxy        Started
root@ubuntu-4gb [bash]:~/nextcloud#>docker compose exec -u www-data app /bin/bash
www-data@19da9378a531:~/html$ echo $PHP_MEMORY_LIMIT
512M
www-data@19da9378a531:~/html$ echo $LETSENCRYPT_TEST
false
www-data@19da9378a531:~/html$ echo $MYSQL_HOST
nextcloud-mariadb:3306

So the variables appear to be picked up, except for the PHP_MEMORY_LIMIT.

Checked my ./app/config/config.php, there was nothing set which would indicate a memory limit.

ps. special thanks for github for labeling my main account as spam just because I wanted to grip on my privacy by using unique email address via simplelogin...

joshtrichards commented 3 months ago

docker compose restart is not sufficient for environment variable changes:

https://docs.docker.com/reference/cli/docker/compose/restart/

Checked my ./app/config/config.php, there was nothing set which would indicate a memory limit.

It won't show up there. It's a PHP parameter. It gets picked up directly by PHP from the environment via /usr/local/etc/php/conf.d/nextcloud.ini