Search code examples
dockerregistryopenshiftkubernetesjobs

Openshift Job container image from internal registry


I have this Kubernetes Job instance:

      apiVersion: batch/v1
      kind: Job
      metadata:
        name: job
      spec:
        template:
          spec:
            containers:
              name: job
              image: 172.30.34.145:5000/myproj/app:latest
              command: ["/bin/sh", "-c", "$(COMMAND)"]
              serviceAccount: default
              serviceAccountName: default
            restartPolicy: Never

How can I write the image name so it always pull from within my own namespace.

I'd like to set it like this:

image: app:latest

But it fails saying it's unable to pull the image


Solution

  • To pull from a different repository then dockerhub you need to specify the host:port part in the image name. As far as I am aware at this point there is no option to change to location of default registry in docker daemon.

    If you are very fixed on the idea, you could fiddle with DNS so it resolves to your image registry instead of dockers one, but that would cut you off from docker hub completely.