メインコンテンツへスキップ
このトピックには、Linux 向けの説明もあります。
このセクションでは、Docker コンテナー内で ABBYY FineReader Engine 12 を実行する手順について説明します。このシナリオでは、2 つのコンテナーを使用します。
  1. ABBYY FineReader Engine を含むコンテナー
  2. Licensing Service を含むコンテナー
このシナリオを実装することで、耐障害性が向上し、すべてのコンテナーを継続的に稼働させることができます。いずれかのコンテナーで障害が発生した場合でも、もう一方を中断することなく再起動できます。 このシナリオでは、*.abbyy.com のライセンス サーバーに接続する Online License を使用します。
ABBYY Licensing Service は、同時に 1 つの Online License でしか動作できません。
必要なもの:
  • Customer Project ID
  • Online License のトークン ファイル
  • ライセンス トークン ファイルのパスワード
ABBYY Licensing Service がインストールされている環境で Online License を使用するには、次の条件を満たす必要があります。
  • 有効なインターネット接続
  • ポート 443 (HTTPS) で *.abbyy.com への接続が許可されていること
  • GoDaddy Trusted Root Certification Authority
Certification Authority の GoDaddy ルート証明書を、Trusted Root Certification Authorities 証明書ストアのローカル コンピューター ストアにインストールする必要があります。証明書の詳細については、GoDaddy の ウェブサイト を参照してください。
Docker コンテナーで ABBYY FineReader Engine 12 を実行するには、次の手順を実行します。
  1. お使いのマシンに Docker for Windows をダウンロードしてインストールします。
  2. Windows の Hyper-V 機能および Containers 機能を有効にします。
  3. コンテナーのインストール時に、“Use Windows containers instead of Linux containers” オプションを選択します。
  4. 空のディレクトリを作成し、その中に次のものを配置します。
  • docker-compose.yml — Docker Compose の構成ファイル (内容は以下を参照)
  • TestAppFolder — 次のものを含むディレクトリ
    • Online License のトークン ファイル
    • このトークン ファイル、そのパスワード、および Customer Project ID を使用するようにコンパイルされたテスト アプリケーション
  • Dockerfile_ls — Licensing Service コンテナー用の Dockerfile (内容は以下を参照)
Dockerfile_ls は、Dockerfile_worker からビルドされた 1 つのコンテナーとのみ連携するコンテナーを構築するためのものです。ABBYY FineReader Engine を含むコンテナーの複数のレプリカが、1 つの Licensing Service と連携するように構成しないでください。
  • LicensingSettings_ls.xml - Licensing Service のライセンス設定パラメーターを記述したファイル (内容は以下を参照)
  • DeployLS.ps1 — Licensing Service を起動するスクリプト (内容は以下を参照)
注: このスクリプトは /standalone キーを指定して Licensing Service を実行します。このキーを使用すると、Licensing Service はフォアグラウンド プロセスとして動作します。これは Docker コンテナーで実行する際のベスト プラクティスです。
  • Dockerfile_worker — ABBYY FineReader Engine とテストアプリケーションを含むコンテナー用の Dockerfile (内容は以下を参照)
  • LicensingSettings_worker.xml - ABBYY FineReader Engine ライブラリのライセンス設定パラメーターを含むファイル (内容は以下を参照)
  • SetUpWorkerLicensing.ps1 - LicensingSettings_worker.xml 内のサーバー名を、docker-compose.yml で指定した名前に置き換えるスクリプト (内容は以下を参照)
  • RunTestApp.ps1 — テストアプリケーションを実行するためのコマンドライン スクリプト (内容は以下を参照)
  1. 次のコマンドを使用して、ABBYY FineReader Engine の配布パッケージを先ほど作成したディレクトリに展開します。
installRnt64.exe /extract InstallDir="<your_directory>/FRE"
  1. コンテナーをビルドして実行するには、次のコマンドを使用します。
docker-compose up
テストアプリケーションを実行した結果がコンソールに表示されます。
コンテナーのベースイメージとして Windows Server Core を使用する場合は、Working with Fonts の説明に従って、ABBYY FineReader Engine のデプロイ後にフォントを設定してください
version: '3'
services:
  ls:
    build:
      context: .
      dockerfile: Dockerfile_ls
    hostname: servername
    networks:
      frenet:
        aliases:
          - servername
    restart: on-failure
  worker:
    build:
      context: .
      dockerfile: Dockerfile_worker
      args:
        - service_address=servername
    depends_on:
      - ls
    networks:
      frenet:
    restart: on-failure
networks:
  frenet:
Dockerfile_ls
# Licensing Service をコピーします
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as fre12_ls
WORKDIR /app
ADD ./FRE/Licensing /app/FRE_Licensing
ADD ./LicensingSettings_ls.xml /app/FRE_Licensing/LicensingSettings.xml
WORKDIR /app/FRE_Licensing
# Licensing Service をインストールします
COPY ./DeployLS.ps1 /app/DeployLS.ps1
EXPOSE 3022
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENTRYPOINT /app/DeployLS.ps1
LicensingSettings_ls.xml
<?xml version="1.0" encoding="utf-8"?>
<LicensingSettings xmlns="http://www.abbyy.com/Protection/LicensingSettings">
  <LocalLicenseServer>
    <ConnectionProtocol ProtocolType="TCP/IP" />
  </LocalLicenseServer>
</LicensingSettings>
echo "Preparing logging folder:"
$folder = "C:\ProgramData\ABBYY\SDK\12\Licenses"
echo $folder
if( (Test-Path -Path $folder) -ne $True ) {
    New-Item -Path $folder -ItemType Directory
}
echo "LicensingSettings.xml found:"
cd "C:/app/FRE_Licensing"
type LicensingSettings.xml
echo "Starting license service..."
.\LicensingService.exe /standalone
 
echo "License service stopped."
return 500
Dockerfile_worker
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as fre12installation
# 展開したライブラリを C:/app/FRE12 フォルダーにコピー
ARG library_src="./FRE/FineReader Engine"
ADD $library_src /app/FRE12
ADD ./LicensingSettings_worker.xml /app/FRE12/Bin64/LicensingSettings.xml
# worker の LicensingSettings.xml 内の <service_address> を置換
ARG service_address
COPY ./SetUpWorkerLicensing.ps1 /app/SetUpWorkerLicensing.ps1
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN /app/SetUpWorkerLicensing.ps1 -ServerAddress $service_address
# テストアプリケーションをコピーして実行
COPY ./TestAppFolder /app/TestAppFolder
COPY ./RunTestApp.ps1 /app/RunTestApp.ps1
CMD /app/RunTestApp.ps1
LicensingSettings_worker.xml
<?xml version="1.0" encoding="utf-8"?>
<LicensingSettings xmlns="http://www.abbyy.com/Protection/LicensingSettings">
  <LicensingServers>
    <MainNetworkLicenseServer ServerAddress="<server_address>" ProtocolType="TCP/IP" />
  </LicensingServers>
</LicensingSettings>
Param (
[string]$service_address
)
# クライアントのライセンスログフォルダーを準備し、LicensingSettings.xml に ServerAddress を設定するスクリプト
echo "Preparing logging folder:"
echo "C:\ProgramData\ABBYY\SDK\12\Licenses"
New-Item -Path "C:\ProgramData\ABBYY\SDK\12\Licenses" -ItemType Directory
echo "LicensingSettings.xml found:"
cd "C:/app/FRE12/Bin64"
type LicensingSettings.xml
echo "Setting service address to: "
echo $service_address
((Get-Content -path LicensingSettings.xml -Raw) -replace '<server_address>',$Env:service_address) `
| Set-Content -Path LicensingSettings.xml
echo "LicensingSettings.xml was set:"
type LicensingSettings.xml
# TestAppFolder フォルダー内のテストアプリケーションを実行するスクリプト
# 引数を指定してテストアプリケーションを起動 (テストアプリケーションとして CommandLineInterface.exe を使用)
cd C:\app\TestAppFolder
.\CommandLineInterface.exe  -pi -if Demo.tif -f PDF -of Demo.pdf
# Docker コンテナーで CommandLineInterface コードサンプルを使用するには、次の作業が必要です:
# 1) SamplesConfig.h で Docker コンテナー用のデータを指定します:
# - GetLicensePath、GetCustomerProjectId、GetLicensePassword
# - GetFreDllPath として L"C:\\app\\FRE12\\Bin64\\FREngine.dll"
# 2) x64 構成向けにプロジェクトを再ビルドします。
# 3) CommandLineInterface.exe、*.ABBYY.ActivationToken ライセンスファイル
#  およびデモ画像 (Demo.tif) を \TestAppFolder フォルダーにコピーします。

関連項目

WindowsへのLicensing Serviceのインストール ライセンス管理 アクティベーション