I have a host OS (Ubuntu) with ClamAV installed. and I am running a Docker container on this OS. This container is running a node web app that is publicly facing.

There is file upload functionality within this web app that uploads to a folder within the docker container.

This folder is "mounted" so that it is accessible from the host OS.

It needs to be scanned for viruses, then it needs to report back to the Docker container app with the results of the scan. These results will then be processed and relayed to the user.

What would be the best way to let the host OS know when a file has been uploaded to this folder?

The ways that have gone through my mind are:

Host OS polling the folder to check for changes (not desirable). The web app triggering some Docker "event" (or similar) to tell the host OS to scan a specific sub-folder (because the files will be uploaded to specific sub-folders and it won't be flat). A specific URL that is hit on the web app that then triggers something to happen on the host OS as it is listen in some way or other. No idea if any, or all these methods are achievable.

  • Can you not integrate clamav with inotify? – Raman Sailopal Oct 11 '17 at 9:09
  • Can you provide any further details of how I would be able to achieve what I am after? – Adrian Roworth Oct 11 '17 at 10:00
  • It may be overkill but you can have inotify monitor any changes to the mounted directory and output the details to a file. This file can then be monitored and parsed via another process with tail -f and clamav actioned. Alternatively, you can run the find command periodically off cron to check for any changes and then run clamav on that file – Raman Sailopal Oct 11 '17 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.