Docker Hubโ - Quay.ioโ - bfren ecosystemโ
ClamAVโ virus scanner, running as a daemon (clamd) that other containers send files to for scanning. It is built on Alpine + S6โ , with ClamAV from Alpine's packages - each ClamAV version uses the newest Alpine release that has it.
The virus database is included in published images, so the scanner is ready quickly, and freshclam keeps it up to date while the container runs.
services:
clamav:
image: quay.io/bfren/clamav:clamav1.4-5.2
restart: unless-stopped
app:
image: your/app
environment:
- CLAMAV_HOST=clamav
- CLAMAV_PORT=3310
Run docker compose up -d - your app connects to clamav:3310 using the clamd protocol (most languages have a client library). To check it is working:
docker compose exec clamav sh -c 'echo PING | nc localhost 3310' # PONG
clamd listening on TCP port 3310 and a local socketclamd reloads it automaticallyclamdImages are published to Docker Hub (bfren/clamav) and Quay.io (quay.io/bfren/clamav) for linux/amd64, linux/arm/v7 and linux/arm64.
| Tag | Example | Use when |
|---|---|---|
clamavX.Y | clamav1.4 | You want the latest image for a ClamAV version |
clamavX.Y-MAJOR | clamav1.4-5 | You want updates, but not breaking changes |
clamavX.Y-MINOR | clamav1.4-5.2 | You want fixes only - recommended |
clamavX.Y-VERSION | clamav1.4-5.2.0 | You want to pin this image exactly |
clamavX.Y.Z | clamav1.4.6 | You want an exact ClamAV release |
latest, 5, 5.2, 5.2.0 | As above, on ClamAV 1.4 |
| ClamAV | Release | Alpine | Support |
|---|---|---|---|
| 1.4 | 1.4.6 | 3.24 | LTS - supported until 2027-08-15 |
| 1.2 | 1.2.2 | 3.20 | ended 2024-12-15 - updates may be blocked |
Use 1.4. ClamAV blocks versions it no longer supports from downloading virus database updates, and 1.2 may be blocked at any time. Images for older versions (0.104, 0.105 and 1.1) are no longer built. A scanner with an old database misses new threats. See ClamAV's end-of-life policyโ .
| Port | Purpose |
|---|---|
3310 | clamd - only needed by other containers |
| Variable | Values | Description | Default |
|---|---|---|---|
BF_CLAMAV_FRESH_PER_DAY | 1 to 50 | How many times a day freshclam checks for updates. | 12 |
See Alpine + S6โ for BF_DEBUG, BF_TZ and the other base image variables.
On every start:
clamd.conf and freshclam.conf are generated in /etc/clamav./var/lib/clamav (e.g. in an image you built yourself), it is downloaded.clamd runs under S6, listening on TCP port 3310 and on /run/clamav/clamd.sock. The container stops if it crashes.freshclam runs under S6, checking for updates BF_CLAMAV_FRESH_PER_DAY times a day and telling clamd to reload after each update. If it stops, S6 starts it again.Both log to docker logs.
The health check (every 30 seconds) sends PING to port 3310 and expects PONG.
./test.nu # builds ClamAV 1.4 and runs /test
./test.nu 1.2 # or any version directory
./test.nu --all # every version, in parallel
./run.sh 1.4 # builds and opens a shell
./generate-dockerfiles.sh # regenerates the Dockerfiles from Dockerfile.esh
/test runs this image's tests alongside the base images' tests: the generated configuration files, finding the database, the freshclam schedule (and its limits), the services and start-up order, and the installed ClamAV version.
The virus database is being downloaded - a few hundred MB. Published images include it, so this only happens with images you build yourself (unless you set BF_PUBLISHING=1 when building).
freshclam reports it is blocked, or the database is out of dateYour ClamAV version is no longer supported. Change to clamav1.4.
clamd isn't answering on port 3310 - it may still be loading the database, which can take a minute or more on small machines and uses over 1GB of memory.
There's no need - published images include it, and freshclam brings it up to date within minutes of starting.
Copyright (c) 2020-2026 bfrenโ (unless otherwise stated)
Content type
Image
Digest
sha256:3bad284d7โฆ
Size
153.8 MB
Last updated
9 minutes ago
docker pull bfren/clamav