Docker 部署sherlock

Relevant source files  相关源文件

This document explains how to deploy and use Sherlock using Docker containers. Docker provides an isolated, consistent environment for running Sherlock without worrying about dependencies or system compatibility issues. For traditional package installation methods, see Package Installation, and for detailed command-line options, see Command Line Interface.
本文档介绍了如何使用 Docker 容器部署和使用 Sherlock。Docker 为运行 Sherlock 提供了一个隔离、一致的环境,而无需担心依赖项或系统兼容性问题。对于传统的软件包安装方法,请参阅软件包安装 ,有关详细的命令行选项,请参阅命令行界面 

Overview of Docker Deployment  Docker 部署概述

Sherlock provides an official Docker image that allows you to run the tool without installing it directly on your system. The Docker deployment packages the Sherlock application and all its dependencies into a containerized environment.
Sherlock 提供了一个官方的 Docker 镜像,允许您运行该工具,而无需直接在系统上安装它。Docker 部署将 Sherlock 应用程序及其所有依赖项打包到容器化环境中。

CommandsRunsExecutesQueriesReadsResponsesWritesMaps to (optional)UserDocker CLISherlock ContainerSherlock BinarySocial NetworksSite ConfigurationsResultsHost Volume

Sources: Dockerfile1-32
资料来源:Dockerfile1-32

Architecture  建筑

The Sherlock Docker image is built using a multi-stage build process. It installs the official Sherlock Python package from PyPI and sets up the execution environment.
Sherlock Docker 镜像是使用多阶段构建过程构建的。它从 PyPI 安装官方 Sherlock Python 包并设置执行环境。

DefinesExcludes files fromBase image forPackage source forCreatesInstantiated asOutputsDockerfileDocker Build Process.dockerignorePython 3.12 Slim BullseyePyPI (sherlock-project)Sherlock Docker ImageRunning ContainerSearch Results

Sources: Dockerfile7-31 .dockerignore1-8
资料来源:Dockerfile7-31.dockerignore 1-8

Prerequisites  先决条件

To use the Sherlock Docker image, you need:
要使用 Sherlock Docker 镜像,您需要:

  1. Docker installed on your system
    您的系统上安装的 Docker
  2. Internet connectivity for pulling the image and making requests
    用于拉取映像和发出请求的 Internet 连接
  3. Basic familiarity with Docker commands
    基本熟悉 Docker 命令

Basic Usage  基本用法

Pulling the Official Image  拉取官方镜像

docker pull sherlock/sherlock:latest

You can also specify a version tag instead of latest to use a specific version of Sherlock.
您还可以指定 version 标签而不是 latest 来使用特定版本的 Sherlock。

To search for a username across all supported sites:
要在所有支持的站点中搜索用户名:

docker run --rm sherlock/sherlock username

Searching Multiple Usernames  搜索多个用户名

docker run --rm sherlock/sherlock username1 username2 username3

Saving Results to a File  将结果保存到文件

docker run --rm -v "$(pwd)/results:/sherlock/results" sherlock/sherlock --output /sherlock/results/output.txt username

Sources: Dockerfile31-32
资料来源: Dockerfile31-32

Command-Line Options  命令行选项

All regular Sherlock command-line options can be passed to the Docker container. For example:
所有常规的 Sherlock 命令行选项都可以传递给 Docker 容器。例如:

docker run --rm sherlock/sherlock --site twitter --timeout 3 --print-found username

For a full list of available options, see Command Line Interface.
有关可用选项的完整列表,请参阅 命令行界面 

Docker-Specific Features  Docker 特定的功能

Execution Flow  执行流程

The following diagram illustrates the execution flow when running Sherlock in a Docker container:
下图说明了在 Docker 容器中运行 Sherlock 时的执行流程:

"Social Networks""Sherlock Container"DockerUser"Social Networks""Sherlock Container"DockerUserloop[For each site]docker run sherlock/sherlock usernameCreate containerExecute ENTRYPOINT ["sherlock"]Process parametersHTTP requestHTTP responseAnalyze responseOutput resultsDisplay results

Sources: Dockerfile31-32
资料来源: Dockerfile31-32

Volume Mounting  卷挂载

To persist data between container runs, you can mount volumes:
要在容器运行之间持久保存数据,您可以挂载卷:

Purpose  目的Docker Command  Docker 命令
Save text results  保存文本结果-v "$(pwd)/output:/sherlock/output"
Save CSV results  保存 CSV 结果-v "$(pwd)/output:/sherlock/output" --csv /sherlock/output/results.csv
Custom site configurations-v "$(pwd)/custom_data.json:/sherlock/custom_data.json"

Environment Variables

The Docker image sets the SHERLOCK_ENV=docker environment variable to indicate it’s running in a Docker environment.

Sources: Dockerfile19

Advanced Usage

Using with Docker Compose

For repeated use or more complex setups, you can use Docker Compose. Create a docker-compose.yml file:

version: '3'
services:
  sherlock:
    image: sherlock/sherlock:latest
    volumes:
      - ./results:/sherlock/results
    command: --output /sherlock/results/output.txt username

Then run:

docker-compose up

Rate Limiting Considerations

When running large searches from a Docker container, you might encounter rate limiting from social media platforms. You can use the --timeout and --rate-limit options to manage this:

docker run --rm sherlock/sherlock --timeout 5 --rate-limit 1.0 username

Building Custom Images

If you need to customize the Sherlock Docker image, you can build your own:

  1. Clone the Sherlock repository
  2. Modify the Dockerfile as needed
  3. Build your custom image:
docker build -t custom-sherlock .

Dockerfile Structure

The official Dockerfile uses:

  • Python 3.12 slim Bullseye as the base image
  • A multi-stage build process for efficiency
  • Installation from PyPI rather than from source code
  • Labels for metadata and versioning

Sources: Dockerfile7-28

Troubleshooting

Common Issues

ProblemPossible Solution
Permission issues with mounted volumesRun with --user $(id -u):$(id -g)
Network connectivityCheck your firewall and proxy settings
Rate limitingUse --timeout and --rate-limit options
Container exiting without resultsAdd --verbose flag for more information

Checking Docker Image Information

To verify the version and details of your Sherlock Docker image:

docker inspect sherlock/sherlock:latest

Sources: Dockerfile21-25

Security Considerations

When using Docker to run Sherlock:

  1. The container runs as root by default – consider using --user flag for reduced privileges
  2. Mounted volumes may expose data – be careful about file permissions
  3. Internet access is required – the container needs to make outbound connections

Versioning

The Sherlock Docker image follows the same versioning as the Sherlock package. Image tags match the package versions, with latest pointing to the most recent release.

Sources: Dockerfile1-6 Dockerfile15-17

Auto-refresh not enabled yet
尚未启用自动刷新

Try DeepWiki on your private codebase with Devin
使用 Devin 在您的私有代码库上试用 DeepWiki

On this page  本页内容

Ask Devin about sherlock-project/sherlock  向 Devin 询问 sherlock-project/sherlockDeep Research  深入研究Add to Context  添加到上下文Press Q  按 Q