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


openspeedtest,docker,phpenv

Run OpenSpeedTest with phpenv

Although we may use websites such as speedtest to test the speed of uploading and uploading, what if we want to test the speed of our own Server? For example, if the user is in another country, the speed of connecting to our host is slow, then the self-hosted test tool is very convenient. The latest version of phpenv has added openspeedtest.yml to the yml file of services.

fastapi,phpenv,docker

How do I create a fastapi runtime environment with phpenv

phpenv php laravel runs HAProxy, and automatically applies for and updates free certification, now let him run Python's fastapi. There is no limit to phpenv, the limit is your idea.😆

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.