How do I run a docker image that I built locally on Google Container Engine?
You can push your image to Google Container Registry and reference them from your pod manifest.
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>
Create a pod manifest for your container: my-pod.yaml
id: my-pod
kind: Pod
apiVersion: v1
desiredState:
manifest:
containers:
- name: <container-name>
image: gcr.io/<your-project>/<your-image>
...
Schedule this pod
kubectl create -f my-pod.yaml
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.