How do I run a docker image that I built locally on Google Container Engine?
相关问题
- Microk8s, MetalLB, ingress-nginx - How to route ex
- How do I change the storage class of existing pers
- Docker task in Azure devops won't accept "$(pw
- Use awslogs with kubernetes 'natively'
- Unable to run mariadb when mount volume
The setup I use is to deploy my own docker registry combined with ssh port forwarding. For that purpose I set up a ssh server in the cluster and use
~/.ssh/config
to configure a port forward to the registry.Also I use jenkins to build the images right in the cloud.
You can push your image to Google Container Registry and reference them from your pod manifest.
Detailed instructions
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
Tag your image
Push your image
Create a pod manifest for your container:
my-pod.yaml
Schedule this 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.You could copy the registry authentication key of your private docker registry to the .dockercfg file in the root directory of the minions right before starting the pods. Or run docker login on minions before starting.
Referring to the private docker image in the pod configuration should then work as expected.