Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Openpalm/a479e5434c3a570cfd2d43b8d80229c6 to your computer and use it in GitHub Desktop.
Save Openpalm/a479e5434c3a570cfd2d43b8d80229c6 to your computer and use it in GitHub Desktop.

Revisions

  1. @rkuzsma rkuzsma revised this gist May 2, 2016. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,11 @@ export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
    export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
    export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`

    kubectl create secret docker-registry myregistrykey --docker-server=$DOCKER_REGISTRY_SERVER --docker-username=$DOCKER_USER --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
    kubectl create secret docker-registry myregistrykey \
    --docker-server=$DOCKER_REGISTRY_SERVER \
    --docker-username=$DOCKER_USER \
    --docker-password=$DOCKER_PASSWORD \
    --docker-email=$DOCKER_EMAIL

    If your username on DockerHub is DOCKER_USER, and your private repo is called PRIVATE_REPO_NAME, and the image you want to pull is tagged "latest", create this dummy.yaml file:

    @@ -21,3 +25,7 @@ spec:
    command: [ "echo", "SUCCESS" ]
    imagePullSecrets:
    - name: myregistrykey


    Then run:
    kubectl create -f dummy.yaml
  2. @rkuzsma rkuzsma created this gist May 2, 2016.
    23 changes: 23 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.

    export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
    export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
    export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
    export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`

    kubectl create secret docker-registry myregistrykey --docker-server=$DOCKER_REGISTRY_SERVER --docker-username=$DOCKER_USER --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL

    If your username on DockerHub is DOCKER_USER, and your private repo is called PRIVATE_REPO_NAME, and the image you want to pull is tagged "latest", create this dummy.yaml file:

    apiVersion: v1
    kind: Pod
    metadata:
    name: foo
    spec:
    containers:
    - name: whatever
    image: index.docker.io/DOCKER_USER/PRIVATE_REPO_NAME:latest
    imagePullPolicy: Always
    command: [ "echo", "SUCCESS" ]
    imagePullSecrets:
    - name: myregistrykey