by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 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,sqlserver

D-Laravel builds SQL Server environment

How to build D-Laravel's SQL Server environment

docker laravel

Chatting about D-Laravel's console commands

D-Laravel's console command allows us to quickly understand what he executes. How is it executed if docker-compose is used? Let's see.

docker,laravel

[D-Laravel]./console node

When developing Laravel, sometimes we need to install nodejs packages through npm, but Node in our system is not new enough. It may be impossible to upgrade due to some factors, such as running an old version of nodejs program, etc. In fact, we can use docker through simple commands, so that we can use the latest version of node image to mount the /sites folder on the host side. In this way, we can execute the new version of the npm command at any time.