Using Docker & Kubernetes

A Docker image is provided for you to evaluate these features. You can download this image as part of the AIStreamer.

Please note that use of third-party software is solely at your discretion. Google does not own the copyright of third-party software.

Prerequistes

Build Docker image

Go into the ingestion directory and run the following command line on your host machine:

$ export DOCKER_IMAGE=gcr.io/gcp-project-name/docker-image-name:version
$ docker build -t $DOCKER_IMAGE -f env/Dockerfile .

Try Docker image on your local host

Run following command in the terminal for your host machine:

$ docker run -it $DOCKER_IMAGE /bin/bash

The command returns a response similar to the following example.

root@e504724e76fc:/#

To open another terminal connecting to Docker, run the following command on the host machine:

$ docker exec -it e504724e76fc /bin/bash

Now, you have both host terminals that are in the same Docker container.

Docker image environment setting

Some environment settings can be customized in the Docker image.

#set up environment for Google Video Intelligence Streaming API
ENV SRC_DIR /googlesrc  #Source code directory
ENV BIN_DIR /google     #Binary directory

Push Docker image to Google Cloud container registry

Run the following command in the terminal for your host machine:

$ gcloud docker --verbosity debug -- push $DOCKER_IMAGE

You might need to set access control.

Deploy to Google Cloud

Run the following commands in the terminal for your host machine:

$ export KUBE_ID=any_string_you_like
$ kubectl run -it $KUBE_ID --image=$DOCKER_IMAGE -- /bin/bash

This returns a response similar to the following:

root@$KUBE_ID-215855480-c4sqp:/#

To open another terminal connecting to the same Kubernetes container on Google Cloud, run the following command line on host machine:

$ kubectl exec -it $KUBE_ID-215855480-c4sqp -- /bin/bash

Now, you have both host terminals that are in the same Kubernetes container on Google Cloud.