I can't get started with dockerized clamav app
I know it is not a bug, but overviewed docs, googled dozen times and still get the same output.
I built a nodejs app with a muter-based upload. There is a function that takes uploded file path and gets NodeClam() instance to work:
import NodeClam from 'clamscan'
// clamscan module configs
const ClamScan = new NodeClam().init({
clamdscan: {
socket: '/var/run/clamav/clamd.sock',
host: '127.0.0.1',
port: 3310,
}
});
// Scan file using clamscan module
export function scanFile(filePath) {
return ClamScan.then(async clamscan => {
const { is_infected, viruses } = await clamscan.scan_file(filePath);
if (is_infected) {
console.log(`The file is INFECTED with ${viruses}`);
throw new Error('ERR_FILE_SCAN_INFECTED');
} else {
return 'CLEAN';
}
}).catch(err => {
console.log(err)
throw new Error(err);
});
}
And than I get this output in node console (printing an error):
[server] Error: connect ENOENT /var/run/clamav/clamd.sock
[server] at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1142:16) {
[server] errno: -4058,
[server] code: 'ENOENT',
[server] syscall: 'connect',
[server] address: '/var/run/clamav/clamd.sock'
[server] }
[server] (node:24904) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
[server] (Use `node --trace-warnings ...` to show where the warning was created)
I checked for directory in docker (via bash) and a file directory seems to be fine:
/run/clamav $ ls -la
total 20
drwxr-x--- 1 clamav clamav 4096 Apr 3 19:16 .
drwxr-xr-x 1 root root 4096 Feb 24 16:02 ..
-rw-rw-r-- 1 clamav clamav 2 Apr 3 19:16 clamd.pid
srw-rw-rw- 1 clamav clamav 0 Apr 3 19:16 clamd.sock
-rw-rw---- 1 clamav clamav 3 Apr 3 19:16 freshclam.pid
/run/clamav $ pwd
/var/run/clamav
Host:
- OS: windows/WSL
- Version 10
Image:
- Tag: mkodockx/docker-clamav:alpine
- Configuration:
clamAV:
image: mkodockx/docker-clamav:alpine
restart: always
ports:
- 3310:3310
volumes:
- ./data/clamav:/var/lib/clamav
What am I missing to do?