Nextcloud Docker Memcache?

Nextcloud version (eg, 20.0.5): 27.1.4
Operating system and version (eg, Ubuntu 20.04): Debian 12
Apache or nginx version (eg, Apache 2.4.25): nextcloud docker image
PHP version (eg, 7.4): nextcloud docker image


I get the following warning in my newly installed Nextcloud container:

The database is used to lock transaction files. To improve performance, please set up Memcache if available.

I have no idea how to do this and the docs don’t make me any smarter. How do I do this?

This is already in the config:

'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,

You’ll need to:

  1. Bring up a Redis container in your Docker environment within your Nextcloud stack
  2. Configure Nextcloud to use your new Redis container for caching

Keep in mind you don’t have to do any of these things, but they will ultimately create a more robust and performant Nextcloud stack.

Let’s focus on item 1 first. In your Docker Compose file the simplest Redis container definition would be something like:

    image: redis:7.0-bullseye
    restart: unless-stopped

Bring that container up in the usual way for your Docker environment.

Now for item 2, once you have the container running you can either add the Redis definition directly into your Nextcloud config.php per Admin Manual or you can add the following two lines to the environment section of your Compose file’s entry for your Nextcloud app container:

    - REDIS_HOST=redis

Recreate your Nextcloud app container if using the environment approach.