148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

marco.cirilli
from marco.cirilli More from this publisher
19.06.2021 Views

Chapter 3 ■ Kubernetes on Google Cloud PlatformNext, build a Docker image using the docker build command.docker build -t gcr.io/kube-gke/hello-node:v1.The Docker image node:4.4, from which the image gcr.io/kube-gke/hello-node:v1 is built, is pulledas shown in Figure 3-63.Figure 3-63. Running the docker build commandThe Docker image is built as shown in Figure 3-64.Figure 3-64. The Docker image built83

Chapter 3 ■ Kubernetes on Google Cloud PlatformRun the Docker image with the docker run command:docker run -d -p 8080:8080 gcr.io/kube-gke/hello-node:v1Invoke the application with the curl command:curl http://localhost:8080The Hello World! message is output as shown in Figure 3-65.Figure 3-65. Running and Invoking the hello-node ApplicationThe Docker image may be pushed to the Google Container Registry, with the following command:gcloud docker push gcr.io/kube-gke/hello-node:v1The command output is shown in Figure 3-66.Figure 3-66. Uploading the Docker Image to Google Container RegistryThe Docker image is pushed to the repository as shown in Figure 3-67.84

Chapter 3 ■ Kubernetes on Google Cloud Platform

Next, build a Docker image using the docker build command.

docker build -t gcr.io/kube-gke/hello-node:v1.

The Docker image node:4.4, from which the image gcr.io/kube-gke/hello-node:v1 is built, is pulled

as shown in Figure 3-63.

Figure 3-63. Running the docker build command

The Docker image is built as shown in Figure 3-64.

Figure 3-64. The Docker image built

83

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!