Adding a container to an existing stack

Hi Community!

Disclaimer: I’m new to Docker and have a lot to learn, so thanks for your clemency! :wink:

I’ve installed a Nextcloud + OnlyOffice stack on my lab server, using Portainer, copying an example docker-compose file into a Portainer stack. I’d now like to add a ClamAV container and found some other docker-compose examples. I then wonder if I can just copy/paste the ClamAV container description into my existing stack, further adapting the different parameters (container names, network, etc.).

Here the snippet I collected from https://github.com/mko-x/docker-clamav:

services:
     av:
       image: mkodockx/docker-clamav:alpine-idb-amd64
       container_name: clamav
       restart: unless-stopped
       volumes:
         - /home/clamav:/var/lib/clamav

Would I just have to add “depends-on: clamav” in the Nextcloud container description? Looks to simple to be true as Nextcloud cannot connect to the ClamAV engine on my first try… :face_with_raised_eyebrow:

Thanks in advance for any help and advice!

You might want to post your full compose file. Usualy the not shared parts are what causes problems.