1

我无法开始使用 dockerized clamav 应用程序

我知道这不是一个错误,但概述了文档,谷歌搜索了几十次,仍然得到相同的输出。

我用基于静音的上传构建了一个 nodejs 应用程序。有一个函数可以获取上传的文件路径并让 NodeClam() 实例工作:

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);
  });
}

而不是我在节点控制台中得到这个输出(打印错误):

[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)

我检查了 docker 中的目录(通过 bash),文件目录似乎没问题:

/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

主持人:

  • 操作系统:windows/WSL
  • 版本 10

图片:

  • 标签: mkodockx/docker-clamav:alpine
  • 配置:
  clamAV:
    image:  mkodockx/docker-clamav:alpine
    restart: always
    ports:
      - 3310:3310
    volumes:
      - ./data/clamav:/var/lib/clamav

我想做什么?

4

1 回答 1

0

删除套接字路径。看到这个问题: https ://github.com/mko-x/docker-clamav/issues/111

于 2021-10-13T23:44:35.450 回答