Install P4 Detect with Docker

P4 Detect is an optional Python-based REST service that provides an API for image tagging using OpenAI's CLIP model.

Use this procedure to install and start the P4 Detect Docker container so that you can enable image tagging for P4 Search.

After you have installed P4 Detect, you can configure it. See Configure P4 Detect.

Do not expose P4 Detect to the public internet.

Before you begin

  • Install and perform the initial configuration of P4 Search.

  • Ensure the host system meets the following requirements:

    • At least 16 GB RAM per P4 Detect instance

    • At least two CPUs per P4 Detect instance

  • Ensure Docker is installed and that your user account has permission to run Docker containers. To learn more, see:

Choose a P4 Detect installation method

Choose one of the following installation methods:

Install P4 Detect with custom image tagging labels

To use your own image tagging labels with P4 Detect, create mount point for the default volumes. Any changes you make to the tagging labels persist when P4 Detect is redeployed.

P4 Detect is provided as a P4 Detect Docker image.

  1. Pull the P4 Detect Docker image:

    docker pull perforce/p4detect:latest

  2. Create the mount points for the configuration, label, and log volumes:

    mkdir -p volumes/p4detect/config
    mkdir -p volumes/p4detect/label_config
    mkdir -p volumes/p4detect/logs
    
  3. Run the P4 Detect container:

    docker run  -d \
        --name p4detect.helix \
        -p 1608:1608 \
        -v ./volumes/p4detect/config:/config \
        -v ./volumes/p4detect/label_config:/label_config \
        -v ./volumes/p4detect/logs:/logs \
        -e WORKERS=1 \
        -e CONFIG_ENV=production \
        -e CONFIG_PATH=/config/config.yml \
        -e LABEL_CONFIG_PATH=/label_config \
        -e LOGGING_PATH=/logs/P4Detect.log \
        -e HOST_UID=$(id -u) \
        -e HOST_GID=$(id -g) \
        perforce/p4detect:latest

    where p4detect.helix is the name of the running container.

  4. Optional: Configure P4 Detect.

  5. Verify that the service is running. Replace <your-host> with your host:

    http://<your-host>:1608/healthy

Install P4 Detect with default image tagging labels

The default.json file contains approximately 30,000 general purpose image labels that you can use with P4 Detect. To use the default.json file with P4 Detect, the default volume mount points are not required.

Any changes made to these labels are non-persistent and will be lost on redeployment.

P4 Detect is provided as a P4 Detect Docker image.

  1. Pull the P4 Detect Docker image:

    docker pull perforce/p4detect:latest

  2. Run the P4 Detect container:

    docker run -d --name p4detect.helix -p 1608:1608 perforce/p4detect:latest

    where p4detect.helix is the name of the running container.

  3. Verify the installation. Replace <your-host> with your host:

    http://<your-host>:1608/healthy

Next steps