At v4.6 the HammerDB Docker Image and Container supports the CLI interface on Linux only.
Containers are lightweight prebuilt environments that are easy to distribute and deploy. Version 4.7 includes both a pre-built Docker Image and a Dockerfile that can be used to create a HammerDB Docker containers. This container is based on an Ubuntu 20.04 base image and provides a ready to use environment to run HammerDB. HammerDB has a dependency on 3rd party driver libraries to connect to the target databases. This docker container installs the required client libraries and sets up the environment that enables connections to the target databases.
A pre-built Docker image is provided on the official TPC site on Docker Hub at https://hub.docker.com/u/tpcorg it is only necessary to follow the Dockerfile build instructions if you wish to build your own Dockerfile from source.
A Dockerfile is a shell script that automates the docker container build. It makes it easier to spawn multiple containers with ease. HammerDBv-4.6 source on GitHub is packaged with a folder “Docker”, that contains all the Docker related files and folders. This folder contains a Dockerfile for building a HammerDB client container that supports all the databases that HammerDB supports, i.e. Oracle, Microsoft SQL Server, IBM Db2, MySQL, PostgreSQL and MariaDB. Dockerfile is easy to customize each one’s requirement.
The HammerDB Dockerfile is stored within the HammerDB GitHub repository. To download the Dockerfile either Clone or Download the ZIP of the the HammerDB source and navigate to the Docker directory.
The Docker container built from this Dockerfile installs the required 3rd party driver libraries for all databases supported in HammerDB except for IBM Db2. As IBM Db2 client libraries are not free to redistribute they must be independently downloaded and added if required. For the build to include IBM Db2, IBM Data Server Driver for ODBC and CLI version 11.5.6 can be downloaded locally and placed in the same location as Dockerfile.
To create an image: Go to the folder containing the Dockerfile and run the docker build command.
docker build -t hammerdb-v4.7 .
To create and start a container named "hammerdb" with the image built in previous section run the following command. The container build is successful but the client libraries for IBM are not installed.
docker run -it --name hammerdb hammerdb-v4.7 bash
Figure 1.16. docker run
If IBM client libraries are manually downloaded and placed alongside Dockerfile, container builds successfully and output looks as follows.