Create your own pdfToolbox Docker images from scratch

Important to note here is that:

  • Licensing requires a callas License Server (running outside the Docker Container) or a License that is not bound to hardware (e.g. an OEM license)
  • A callas License Server itself cannot run in a Docker Container
  • In general, only the 64bit callas binaries can run inside a Docker Container

Terminology

  • Docker Host: The Operating System that executes the docker program
  • Docker Image: Some kind of Filesystem (comparable to a readonly ISO CDROM Image)
  • Docker Container: A docker Image that is executed by the docker program
  • callas OS binary: The OS specific callas software executable, e.g.
    • pdfToolbox.exe (for Windows)
      • Only the CLI edition is supported (not the GUI edition)
      • Only supported on Microsoft Windows Docker Hosts
      • Only supported for Microsoft Windows Docker Images
      • In other Words: It is not possible to run native Microsoft Windows binaries inside a Linux Docker Host (or a MacOS Docker Host)
    • pdfToolbox (for Linux)
      • Supported on every Docker Host platform (Linux, Windows and MacOS)
      • Needs a Linux glibc compatible Docker container. As a consequence Alpine Linux Containers are not supported (not based on glibc)
      • Windows specific: only the Linux mode is supported (Hyper-V Isolation)
    • pdfToolbox (for MacOS)
      • Not possible (there are no MacOS Docker Images)

Preparing "enriched" Docker Images

A Docker image must contain the needed runtime dependencies for the callas application (aka Binary). This will be named an enriched Docker image.

It is recommended to use a Dockerfile  to prepare such an enriched Docker image

Note: It is also recommended to use a dedicated build directory that contains the Dockerfile, e.g. a directory named docker_build

Note: Only the Docker base images used in the examples below are officially supported by callas software. In other words: you are free to use different base images. But (as there are thousands of different base images) only the base images mentioned here are officially supported by callas software.

Enriched Docker Images for Linux Binaries

As a base image, the official debian:latest image will be used. There are many external dependencies but these dependencies will be automatically fetched and installed

Preparation

Create a text file named Dockerfile inside the docker_build directory

FROM debian:latest

# add some additional repositories (and packages)
RUN sed -i 's,main$,main contrib non-free,' /etc/apt/sources.list.d/debian.sources \
        && apt update \
        && apt install -y  \
                fontconfig  \
                libfreetype6  \
                lsb-release \
                vim-tiny  \
                perl-modules  \
                ttf-mscorefonts-installer  \
        && apt autoremove \
        && apt autoclean \
        && rm -r -f /var/lib/apt/lists \
        && rm -r -f /usr/share/doc \
        && rm -r -f /usr/share/man

CMD ["/bin/bash"]
Click to copy

Building

Now use the Docker build command to create the enriched image (named debian-enriched)

cd <directory containing Dockerfile>
docker build -t debian-enriched .
Click to copy

And verify

docker images debian-enriched
    REPOSITORY          TAG      IMAGE ID            CREATED             SIZE
    debian-enriched     latest   3d359679e001        20 minutes ago      218MB
Click to copy
Enriched Docker Images for Microsoft Windows Binaries

As a base image the official servercore:ltsc2019 image will be used. External dependencies are only Microsoft Visual Studio Distributable (VC_redist.x64.exe). But it needs to be downloaded manually.

Preparation

Download VC_redist.x64.exe into the docker_build directory (URL: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) and create a text file named Dockerfile inside the docker_build directory.

FROM mcr.microsoft.com/windows/servercore:ltsc2019
RUN MKDIR \tmp

# VC_redist.x64.exe from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
COPY VC_redist.x64.exe \tmp
RUN start /w \tmp\VC_redist.x64.exe /install /quiet /norestart

USER ContainerUser
Click to copy

Building

Use the docker build command to create the enriched image (named servercore-enriched)

cd <directory containing Dockerfile and VC_redist.x64.exe>
docker build -t servercore-enriched .
Click to copy

And verify

docker images servercore-enriched
  REPOSITORY            TAG     IMAGE ID            CREATED             SIZE
  servercore-enriched   latest  1ad53e86e52f        16 minutes ago      3.86GB
Click to copy

Running a callas product in a Docker Container

Note: This requires an already running callas License Server (loaded with a cartridge that matches the product), e.g. running on 192.168.44.11

Linux and MacOS Docker hosts

unpack the pdfToolbox Installer .tar.gz into a dedicated directory (e.g./opt/callas/callas_pdfToolboxCLI_x64_Linux_11-1-542)

cd /opt/callas/callas_pdfToolboxCLI_x64_Linux_11-1-542
docker run --rm -v $(pwd):/callas -t -i debian-enriched
Click to copy

Now we are inside a Linux Docker Container.

cd /callas
./pdfToolbox --saveasimg <path to PDF> --licenseserver=192.168.44.11
Click to copy
Windows Docker hosts
  • Unpack the pdfToolbox CLI Installer (not the Desktop GUI Installer)
  • Install the pdfToolbox CLI into a dedicated directory (not the default system directories), e.g use C:\docker\callas_pdfToolboxCLI11_x64_Win_11-1-542
cd C:\docker\callas_pdfToolboxCLI11_x64_Win_11-1-542
docker run --rm -ti --mount "type=bind,source=%cd%,target=c:/callas" servercore-enriched
Click to copy

Now we are inside a Windows Docker Container.

cd \callas
pdfToolbox.exe --saveasimg <path to PDF> --licenseserver=192.168.44.11
Click to copy