by Devin Yang
(This article was automatically translated.)

Published - 5 years ago ( Updated - 5 years ago )

I just watched Story of Yanxi Palace recently, so I wanted to introduce a MacOS anti-drug strategy.
This article teaches you how to use Docker to clean MacOS.

Briefly introduce how we use OpenSource anti-virus software to scan through docker.
It is assumed that my current directory is in my home directory, so ${PWD} represents the directory, so my home directory will be mounted to the scan folder in the container.
When I use clamscan -r /scan/ -l clamav.log, I can scan all files in my home directory on MacOS,
Adding the -r parameter will use the recursive method to enter the subdirectory layer by layer to scan,
Adding -l can generate a log of the scanned file, which is displayed directly on the standard output (stdout) by default.

The following is the complete process:

#Execute the Ubuntu container and enter the container
docker run --rm -v ${PWD}:/scan -ti ubuntu bash

#Update ubuntu system
apt-get update

# Install antivirus software
apt-get install clamav

#Update virus pattern
fresh clam

# scan
root@6374ee5a469f:/scan# clamscan -l /scan/clamav.log -r /scan/
....slightly......
/scan/cut version HTML.zip: OK
/scan/Lecture system optimization.docx: OK
/scan/Refund_Refund rules for each district_ok.xlsx: OK

-----------SCAN SUMMARY-----------
Known viruses: 6641063
Engine version: 0.100.1
Scanned directories: 1
Scanned files: 122
Infected files: 0
Data scanned: 79.29 MB
Data read: 742.52 MB (ratio 0.11:1)
Time: 17.035 sec (0 m 17 s)
root@7590c5c17f32:/#
Above is the simulated screen.


As an aside, smart you, have you noticed that because it is a Docker environment, you need to slightly adjust the configuration file of docker-compose.
We can easily mount the site folder, so that we can access the project on D-Laravel Let's clean it up.
Of course, we have to build a clamav image file ourselves.
 

Tags: docker

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


docker

The use of iptabels is required in the Docker Swarm environment

First of all, in the Linux environment, Docker uses iptables rules to provide network isolation. However, in the environment of Docker swarm mode, we cannot identify the connection port under 127.0.0.1 of the host. At this time, we can customize the rules through the DOCKER-USER chain in iptables.

docker,Synology

How to modify the logging driver of Docker on Synolog NAS

On my Synolog Nas, a strange logging driver named db is running by default, how to modify it to a normal json-file? In Synolog's Nas, his Daemon config file is special, and it is placed in the /var/packages/Docker/etc/ directory. Called dockerd.json.

docker,phpenv

Unable to ping host.docker.internal on Linux

You can check with docker version, confirm that the version is Docker v20.10+, you can add extra_hosts as follows: