Building a Docker Image with TIBCO ComputeDB Binaries

The following instructions outline how to build a Docker image if you have the binaries of TIBCO ComputeDB.

Note

TIBCO ComputeDB does not provide a Docker image. You must build it explicitly.

Before building the Docker image, ensure the following:

  • You have Docker installed, configured, and it runs successfully on your machine. Refer to the Docker documentation for more information on installing Docker.
  • The Docker containers have access to at least 4GB of RAM on your machine.

Note

To allow non-root users to run Docker commands, follow the instructions here

Verifying Docker Installation

In the command prompt, run the command:

$ docker run hello-world

Building Docker Image of TIBCO ComputeDB

You can use the Dockerfile that is provided and create your own Docker image of TIBCO ComputeDB. Download the Dockerfile script and place it into a directory. The Dockerfile contains a link to the latest TIBCO ComputeDB OSS version to build the image.

Note

To download the Dockerfile on Linux or MAC, use the wget command.
wget https://raw.githubusercontent.com/SnappyDataInc/snappy-cloud-tools/master/docker/Dockerfile

Move into the directory containing the downloaded Dockerfile and then run the Docker build command with the required details to build the Docker image.

If you have already downloaded the TIBCO ComputeDB tarfile locally onto your machine, use the following steps to build an image from the downloaded binaries. To download TIBCO ComputeDB, refer to the Provisioning TIBCO ComputeDB section in the product documentation.

Copy the downloaded tar.gz file to the Docker folder where you have placed the Dockerfile and run the following command:

$ docker build -t <your-docker-repo-name>/<image_name>[:<image-tag>] . --build-arg TARFILE_LOC=<tarfile name>

For example:

$ docker build -t myrepo/computedb . --build-arg TARFILE_LOC=computedb-1.2.0-bin.tar.gz

Verifying Details of Docker Images

After the Docker build is successful, you can check the details for Docker images using the docker images command.

For example:

$ docker images

Publishing Docker Image

If you want to publish the Docker image onto the Docker Hub, log in to the Docker account using docker login command, and provide your credentials. For more information on Docker login, visit here. After a successful login, you can publish the Docker image using the docker push command.

$ docker push <your-docker-repo-name>/<image_name>[:<image-tag>]

Ensure to use the same name in the docker push that is used in docker build.

For example:

$ docker push myrepo/computedb

Note

This example only showcases how to push an image onto Docker Hub. You can also publish the image to other container registries such as gcr.io. For publishing on gcr.io, you can refer this document.

Launching TIBCO ComputeDB Container

The command to launch the TIBCO ComputeDB container is different for Linux and macOS.

Launching TIBCO ComputeDB Container on Linux

In the command prompt, execute the following commands to launch the TIBCO ComputeDB cluster in a single container.

$ docker run -itd --net=host --name <container-name> <your-docker-repo-name>/<image_name>[:<image-tag>] start all

# -i: keep the STDIN open even if not attached.
# -t: Allocate pseudo-TTY.
# -d: Detach and run the container in background and print container ID.
# --net=host: Use the Docker host network stack.

If the image is not available locally, this fetches the Docker image from the Docker registry, launches a default cluster consisting of one data node, one lead, and one locator in a container.

$ docker run -itd --net=host --name computedb myrepo/computedb start all

Launching TIBCO ComputeDB Container on macOS

If you are using macOS, you must redirect the ports manually using the -p parameter. If you use --net=host, it may not work correctly on the macOS. You can use the following modified command for macOS:

$ docker run -d --name=computedb -p 5050:5050 -p 1527:1527 -p 1528:1528 myrepo/computedb start all -hostname-for-clients=<Machine_IP/Public_IP>

The -hostname-for-clients parameter sets the IP Address or Hostname that the server listens for client connections. The command may take a few seconds to execute.

Commonly used Docker Commands

Description Docker Commands
To check details of all the Docker containers $ docker ps -a
To check the Docker logs $ docker logs <container-name>
To launch Snappy Shell $ docker exec -it <container-name> ./bin/snappy
To launch a Spark Shell. $ docker exec -it <container-name> ./bin/spark-shell
To stop the cluster. $ docker exec -it <container-name> ./sbin/snappy-stop-all.sh
To stop the container. $ docker stop <container-name>
To open bash shell inside the container. $ docker exec -it <container-name> /bin/bash