Commit 754b3cea authored by nimrod's avatar nimrod
Browse files

ClamAV daemon image.

parent a02baa9e
Loading
Loading
Loading
Loading

clamd/.dockerignore

0 → 100644
+5 −0
Original line number Diff line number Diff line
*
!entrypoint
!clamd.conf
!clamd-ping
!clamd-update

clamd/Dockerfile

0 → 100644
+19 −0
Original line number Diff line number Diff line
FROM debian:stretch-slim
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        clamav-daemon \
        clamav-freshclam \
        netcat-openbsd \
        procps \
    && \
    freshclam --verbose --stdout && \
    rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
COPY --chown=root:root clamd.conf /etc/clamav/
RUN clamconf -n
COPY --chown=root:root entrypoint /entrypoint
COPY --chown=root:root clamd-ping clamd-update /usr/local/bin/
EXPOSE 3310
VOLUME /run/clamav
ENTRYPOINT [ "/entrypoint" ]
CMD [ "clamd" ]
HEALTHCHECK CMD clamd-ping

clamd/README.md

0 → 100644
+26 −0
Original line number Diff line number Diff line
# clamd

> ClamAV container image.

## Exposed interfaces

The daemon is accessible over TCP at port 3310 and over the `clamd.ctl` Unix
socket in the `/run/clamav` volume.

## Updates

The image comes with an updated virus database from the time the image was
built. To update the database run `clamd-update` from inside the container with
`docker exec` (there's no need to restart the container afterwards). For an
example see the [Cron image](../crond) inside this project.

## License

This software is licensed under the MIT license (see `LICENSE.txt`).

## Author Information

Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
https://www.shore.co.il/). Patches are welcome via [`git send-email`](
http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
at: <https://www.shore.co.il/git/>.

clamd/clamd-ping

0 → 100755
+6 −0
Original line number Diff line number Diff line
#!/bin/sh
set -eux

echo PING | nc -U /run/clamav/clamd.ctl || exit 1
echo PING | nc -t localhost 3310 || exit 1
exit 0

clamd/clamd-update

0 → 100755
+13 −0
Original line number Diff line number Diff line
#!/bin/sh
set -eux

i=0
while ! clamd-ping
do
    i=$(( i + 1 ))
    [ "$i" -lt '5' ] || exit 1
    sleep 10
done

freshclam --verbose --stdout
#echo RELOAD | nc -U /run/clamav/clamd.ctl
Loading