How to build Redis on Portainer (Stacks) and attach to Nextcloud docker network

I have developed Redis for my Nextcloud to prevent file locking errors, thereby facilitating smooth uploads and enabling 24/7 usage instead of a failure to upload.

Lets start by creating a network.

docker network create redis

Then go Portainer to create stacks.

Portainer site → login admin account → stacks → add stacks

version: '3.3'
services:
  redis:
    container_name: redis
    image: redis
    networks:
      - redis
    restart: unless-stopped
    command: redis-server --requirepass KWPvQ9VQ%V3KKShgg%SDq
networks:
  redis:
    external: true

Deploy the stack and this app is now online. Make sure you put Nextcloud config to connect to the Redis server we created.

config.php – added my sever Redis information going in Nextcloud’s config.php
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'redis',
    'port' => 6379,
    'timeout' => 0.0,
    'password' => 'KWPvQ9VQ%V3KKShgg%SDq',
  ),

You’re now ready to use Redis with your Nextcloud.