how to debug container images using openshift how to debug container images using openshift docker docker

how to debug container images using openshift


There are three main commands to debug pods:

  1. oc describe pod $pod-name -- detailed info about the pod

  2. oc logs $pod-name -- stdout and stderr of the pod

  3. oc exec -ti $pod-name -- bash -- get a shell in running pod

To your specific problem: oc run default pull policy is set to Always. This means that OpenShift will try to pull the image until successful and refuse to use the local one.

Once this kuberenetes patch lands in OpenShift origin, the pull policy will be easily configurable.


Please do not consider this a final answer to the question and supersede it with your own better answers...

I'm now using a pod configuration file like the following...

apiVersion: v1kind: Podmetadata:  name: "authoritative-dns-server"  # pod name, your reference from command line  namespace: "myproject"  # default namespace in `oc cluster up`spec:  containers:    - command:        - "bash"      image: "authoritative-dns-bind"  # use your image!      name: "authoritative-dns-bind-container"  # required      imagePullPolicy: "Never"  # important! you want openshift to use your local image      stdin: true      tty: true  restartPolicy: "Never"

Note the command is explicitly set to bash. You can then create the pod, attach to the container and run the docker command yourself.

oc create -f pod.yamloc attach -t -i authoritative-dns-server/files/run-bind.py

This looks far from ideal and it doesn't really help you debug an ordinary openshift container with standard pod configuration, but at least it's possible to debug, now. Looking forward to better answers.