Skip to content

Bookinfo Docker image build and push workflow

The Bookinfo application is a standard sample application used for demonstrating and testing Istio features. This workflow outlines the process for building Docker images for the Bookinfo microservices, pushing them to a registry, and updating the necessary Kubernetes manifests^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

It is standard practice for contributors to build and push images to their own personal Docker repositories to validate changes before requesting an official build^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

Building Images

To build the Docker images locally, navigate to the Bookinfo directory and execute the build-services.sh script^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]. This script requires two arguments:

  • <version>: The tag to apply to the Docker image.
  • <prefix>: The Docker Registry username or prefix (e.g., docker.io/username).
cd samples/bookinfo
src/build-services.sh <version> <prefix>

For example, running src/build-services.sh 1.16.3 docker.io/shamsher31 will build the services and tag them accordingly (e.g., shamsher31/examples-bookinfo-ratings-v2:1.16.3)^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

Note that Bookinfo versioning is independent of Istio versioning, meaning the samples are designed to work across various versions of Istio^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

Pushing Images and Updating Manifests

Once the images are built successfully, they must be pushed to a registry and the Kubernetes YAML files must be updated to reference the new image tags^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]. This can be performed as a combined operation using the build_push_update_images.sh script^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

./build_push_update_images.sh <version> --prefix=<prefix>

For example:

./build_push_update_images.sh 1.16.3 --prefix=shamsher31

This script performs three actions: it builds the Docker images, pushes them to Docker Hub, and updates the deployment files located in platform/kube/bookinfo*.yaml with the specified tag^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

Verification and Testing

After pushing the images, verification is required to ensure the application functions correctly with the new artifacts^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

Deployment and Pod Status

First, deploy the application using the updated YAML manifests^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]:

[kubectl](<./kubectl.md>) apply -f samples/bookinfo/platform/kube/bookinfo.yaml

Monitor the pods until they are all in the Running state^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]:

[kubectl get pods](<./kubectl-get-pods.md>)

Functional Testing

Verify functionality by executing a command from within a running pod (e.g., the ratings service) to check connectivity to the productpage^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]:

[kubectl](<./kubectl.md>) exec -it "$([kubectl](<./kubectl.md>) get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>"

You should also verify the application visually via the browser by accessing the productpage URL, which typically displays the "Simple Bookstore App" with star ratings^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

If all tests pass, the contributor may request an official set of images be built and pushed by the reviewer^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].

Sources

  • 400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md