Nextcloud AIO Docker change php memory limit values

Hi there,

I’m trying to increase the php memory limit inside my Nextcloud AIO docker install and have had no idea where the php.ini file is stored. If someone could let me know where it’s stored that would be great as there’s no documentation stating the location that I’ve found

1 Like

Hi @tekkifygamer

For the official Docker Nextcloud build, you can pass the limits to the container via environment variables ()

Maybe this also works with the AIO Nextcloud.

Assuming you are using docker-compose to start your containers, it could look something like this:

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

1024M is just an example as both are 512M by default. You, however, need to adjust them to fit your needs and the available memory on your server.

1 Like

I am sorry, I am not a docker expert. I have read a docker tutorial, but am still not sure how to do that …
Are you saying that I have to run docker stop nextcloud-aio-mastercontainer ?
And then I spin up a container from a new image with the environment variables you listed above?:

docker run \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--env SKIP_DOMAIN_VALIDATION=true \
--env NEXTCLOUD_MOUNT=/localdata/ \
--env NEXTCLOUD_DATADIR=/localdata/nextcloud \
--env PHP_MEMORY_LIMIT=1024M \
--env PHP_UPLOAD_LIMIT=1024M \
--publish 80:80 \
--publish 8080:8080 \
--publish 8443:8443 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest

yes, stop and remove it and then use the command that you’ve written down.

1 Like

Thanks! :slight_smile:
Seems to have worked, it’s much faster.

Hello, i neeed memory limit values to 1024,As I understood

Commnad is correct?

1: docker stop nextcloud-aio-mastercontainer

2:docker rm /nextcloud-aio-mastercontainer

3: docker run
–sig-proxy=false
–name nextcloud-aio-mastercontainer
–restart always
–env SKIP_DOMAIN_VALIDATION=true
–env NEXTCLOUD_MOUNT=/localdata/
–env NEXTCLOUD_DATADIR=/localdata/nextcloud
–env PHP_MEMORY_LIMIT=1024M
–env PHP_UPLOAD_LIMIT=1024M
–publish 80:80
–publish 8080:8080
–publish 8443:8443
–volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config
–volume /var/run/docker.sock:/var/run/docker.sock:ro
nextcloud/all-in-one:latest

So Nextcloud container ,why not start?

Please helpe me Memory Limit Increase…any more tips otimization nextcloud?

For Nextcloud AIO, at least the manual-install config file has the var
NEXTCLOUD_MEMORY_LIMIT setting item which should map to PHP_MEMORY_LIMIT for nextcloud php container in AIO.
You can try.

Please can explain to me step by step, not expert, docker. Thanks you

By default is each PHP process in the Nextcloud container limited to a max of 512 MB. You can adjust the memory limit by providing --env NEXTCLOUD_MEMORY_LIMIT=512M to the docker run command of the mastercontainer (but before the last line nextcloud/all-in-one:latest! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must start with a number and end with M e.g. 1024M.

This is part of readme.md of Nextcloud All-in-one, the AIO project.

For my understanding, PHP_MEMORY_LIMIT is the standard variable,
And AIO use NEXTCLOUD_MEMORY_LIMIT and transfer it to PHP_MEMORY_LIMIT of the nextcloud app container
as AIO has multiple containers.

2 Likes

Ok, i did full ok. but memory limit show sistem 512M not change is normal… how can check if really changed…commnad line…

Did you already restart the containers from the AIO interface?

Yes, i did restart AIO, and clear cache too, Value has not changed…

step by step.

1: docker stop nextcloud-aio-mastercontainer

2: docker rm /nextcloud-aio-mastercontainer

3: docker run
–sig-proxy=false
–name nextcloud-aio-mastercontainer
–restart always
–env SKIP_DOMAIN_VALIDATION=true
–env NEXTCLOUD_MOUNT=/localdata/
–env NEXTCLOUD_DATADIR=/localdata/nextcloud
–publish 80:80
–publish 8080:8080
–publish 8443:8443
–volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config
–volume /var/run/docker.sock:/var/run/docker.sock:ro
–env PHP_NEXTCLOUD_MEMORY_LIMIT=1024M
nextcloud/all-in-one:latest

Did I do something wrong…

The variable is wrong. You need to use NEXTCLOUD_MEMORY_LIMIT.

1 Like

Oh, man! You did a person happy to day! :wink: Thanks so much.

So can you see the Memory limit: 512 MB has increased.
I am following the same steps but I cant see it is increased.

Steps I followed…

docker stop nextcloud-aio-mastercontainer
docker rm nextcloud-aio-mastercontainer

then ran the following command

sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 80:80 \
--publish 8080:8080 \
--publish 8443:8443 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--env SKIP_DOMAIN_VALIDATION=true \
--env NEXTCLOUD_MEMORY_LIMIT=4096M \
nextcloud/all-in-one:latest

anything I am missing ??

Did you already restart the containers from the AIO interface?

Oh thanks…

I did not noticed that.

image

Thank you very much. :heart_eyes:

sudo docker run --sig-proxy=false --name nextcloud-aio-mastercontainer --restart always --publish 80:80 --publish 8080:8080 --publish 8443:8443 --env nextcloud_memory_limit=4096M --env PHP_MEMORY_LIMIT=4096M --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume /var/run/docker.sock:/var/run/docker.sock:ro --env NEXTCLOUD_ADDITIONAL_APKS=“ocrmypdf tesseract-ocr tesseract-ocr-eng libreoffice” nextcloud/all-in-one:latest

Still is gives that it will only use 512MB

Did you already restart the containers from the AIO interface?