Containers are lightweight prebuilt environments that are easy to distribute and deploy. Version 4.11 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 than be downloaded with the docker pull command either for a complete image for all databases but also database specific images.
docker pull tpcorg/hammerdb docker pull tpcorg/hammerdb:mysql docker pull tpcorg/hammerdb:maria docker pull tpcorg/hammerdb:oracle docker pull tpcorg/hammerdb:postgres docker pull tpcorg/hammerdb:mssqls
The official HammerDB Docker images are hosted by the TPC-Council.
It is only necessary to follow the Dockerfile build instructions if you wish to build your own Dockerfile from source.
HammerDB provides an additional Docker image for running the HammerDB GUI as a Web Application accessed through a web browser. This is particularly useful running in a cloud environment where a local Desktop environment is not readily available. f you want access to functionality such as CPU metrics then you should use the –net-host option.
$ sudo docker run --net=host --name hammerdb-cloudtk tpcorg/hammerdb:latest-cloudtk can't find package limit Running with default file descriptor limit /debug user "debug" password "sycu4xfc.gcw" httpd started on port 8081 secure httpd started on SSL port 8082
Otherwise you can only expose the ports as needed.
docker run -p 8081:8081 -p 8082:8082 -p 8080:8080 --name hammerdb-cloudtk hammerdb:cloudtk
You can connect to port 8081 for an unencrypted connection. Alternatively you can use an encrypted connection on port 8082. By default sample self-signed certificates are installed and these should be replaced by your own.
Click Submit Query on the Launcher.
HammerDB will then run fully contained within a browser, giving access to the GUI from cloud environments where the Desktop may not be readily available.
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.11 .
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.11 bash
Figure 1.20. docker run
If IBM client libraries are manually downloaded and placed alongside Dockerfile, container builds successfully and output looks as follows.