如何在Google集装箱引擎上运行私人码头服务器图像 [英] How do I run private docker images on Google Container Engine
问题描述
如何运行我在 Google集装箱引擎上本地构建的码头服务器映像?
How do I run a docker image that I built locally on Google Container Engine?
推荐答案
您可以将图片推送到 Google Container Registry ,并从您的pod清单中引用它们。
You can push your image to Google Container Registry and reference them from your pod manifest.
假设您正确设置了一个 DOCKER_HOST
,则运行最后版本的Kubernetes的GKE集群和 Google Cloud SDK 。
Assuming you have a DOCKER_HOST
properly setup , a GKE cluster running the last version of Kubernetes and Google Cloud SDK installed.
-
设置一些环境变量
Setup some environment variables
gcloud components update kubectl
gcloud config set project <your-project>
gcloud config set compute/zone <your-cluster-zone>
gcloud config set container/cluster <your-cluster-name>
gcloud container clusters get-credentials <your-cluster-name>
标记您的图像
Tag your image
docker tag <your-image> gcr.io/<your-project>/<your-image>
推送您的图片
Push your image
gcloud docker push gcr.io/<your-project>/<your-image>
为您的容器创建一个pod清单: my-pod。 yaml
id: my-pod
kind: Pod
apiVersion: v1
desiredState:
manifest:
containers:
- name: <container-name>
image: gcr.io/<your-project>/<your-image>
...
安排此pod
Schedule this pod
kubectl create -f my-pod.yaml
从步骤(4)重复您要运行的每个pod。您可以使用 ---
作为分隔符在一个文件中使用多个定义。
Repeat from step (4) for each pod you want to run. You can have multiple definitions in a single file using a line with ---
as delimiter.
这篇关于如何在Google集装箱引擎上运行私人码头服务器图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!