daton's mac
  • Introduction
  • Hackintosh
    • Requirements
    • Prepare USB Drive
    • Install OSX
    • Post installation
    • WiFi and Bluetooth PCI device
    • System Updates
    • Keyboard Mapping
    • Troubleshooting
  • Windows with WSL
    • Setup for Node.js
    • LinuxBrew
    • Powershell
    • WSL bash and zsh
  • Xcode
  • Homebrew
  • iTerm2
    • Plugins
  • Gifox
  • Node.js
    • Webpack
  • VS Code
  • SSH
  • Git
  • GitKraken
  • Docker
    • Remove Docker things
    • Env vars
    • Frequently used commands
  • Docker on Windows
  • MongoDB
  • Postgres
  • Sentry
  • Redis
  • Ghostscript and Imagemagick
  • Codeanywhere
  • Terraform
  • Kubernetes
    • Helm
    • Docker Desktop for Mac
    • Kubernetes on DigitalOcean
    • K8S with Traefik as IC
    • Kubernetes managed by StackPointCloud
    • Use Docker Images from Private Registry
    • Use a minikube locally
  • Web Apps
  • IoT
  • NVIDIA
Powered by GitBook
On this page
  • Login into the registry
  • Create the secret
  • Create a Pod that uses your Secret
  1. Kubernetes

Use Docker Images from Private Registry

Login into the registry

On your laptop, you must authenticate with a registry in order to pull a private image:

docker login

When prompted, enter your Docker username and password.

The login process creates or updates a config.json file that holds an authorization token.

View the config.json file:

cat ~/.docker/config.json

The output contains a section similar to this:

{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": "c3R...zE2"
        }
    }
}

Create the secret

Create the base64 of the docker config.json file:

base64 ~/.docker/config.json > docker-registry-secret.yml

Now edit the docker-registry-secret.yml file like this:

apiVersion: v1
kind: Secret
metadata:
  name: docker-registry
  namespace: default
data:
  .dockerconfigjson: PUT_THE_BASE64_HERE
type: kubernetes.io/dockerconfigjson

Now create the secret into kubernetes cluster:

kubectl apply -f docker-registry-secret.yml

Create a Pod that uses your Secret

Now in your deployment.yml:

apiVersion: v1
kind: Deployment
metadata:
  name: app
spec:
  containers:
  - name: app
    image: <your-private-image>
  imagePullSecrets:
  - name: docker-registry
PreviousKubernetes managed by StackPointCloudNextUse a minikube locally

Last updated 5 years ago