Introduction

This article shows how to use secrets to pull an image from a private Docker registry.

 

Description

Incredibly powerful, Kubernetes offer a simple way to manage your secrets and customize the default registry (Docker Hub).

In this example, we’ll use the Gilab Container Registry service.

 

Let’s go!

Create a file ~/.dockerconfig with your registry credentials on your local machine.

 

Export variables from~/.dockerconfig.

 

To verify the configuration.

 

You should have the same output:

 

Everything is ok, let’s create Kubernetes gitlab-registry secret.

 

It’s time to test it!

 

To check if your private image has been pulled, your can:

 

Extra

 

To remove the created pod.

 

To remove local Docker configuration.

 

To sharing the secret across multiple Kubernetes namespaces.

 

 

Leave a comment