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

D-Laravel on .env and docker-compsoe small classroom

This article introduces why the docker-compose ps official command cannot list all the services in use when we use D-Laravel's .env to load multiple yml files. But the ./console ps on D-Laravel can indeed display normally, so how can the official docker-compose command be used to have the same effect?

docker, api

Introduction to Swagger

The best APIs are built using the Swagger tool, This article introduces how to use docker to execute swagger-ui and editor, let us create a testable API file. In the docker environment, we can easily start the swagger editor and user interface.

docker,cli

Docker container formatted display

I think if you want to write some automation functions, it may be useful to be able to format the output container content. The following are some reference examples of Docker container formatting and display instructions