How to use a private Docker registry

A lot of companies have their own private Docker registry to host their Docker images. Or they have private repositories on Docker Hub.

If you have images referenced in your Dockerfile that are not publicly available from Docker Hub (maybe something like FROM mycompany/secretproject:latest) you can give WunderPreview the configuration to your private Docker registry so WunderPreview can pull your images when it is building your previews.

This also works if your Docker images are on Docker Hub, but not publicly available and you need to login with your Docker Hub credentials to pull those images.

You can configure your private Docker registry with environment variables in your repositories settings in WunderPreview.

Here is how:

1) Go to your repository's settings

Select one of your GitHub organizations in WunderPreview. In the list of the repository click on the little cog on the right side to enter the settings screen.

2) Add Docker registry configuration

Add three environment variables to your repository. The variables must be named:

  • WDPR_PRIVATE_DOCKER_REGISTRY_USERNAME the username that is used in the "docker login" command.
  • WDPR_PRIVATE_DOCKER_REGISTRY_PASSWORD the password that is used in the "docker login" command.
  • WDPR_PRIVATE_DOCKER_REGISTRY_SERVER the server to which the "docker login" command should connect. If you want to use the default Registry from Docker Hub, you need to specify https://index.docker.io/v1/

In the end it should look something like this:

Private Docker registry configuration in WunderPreview
Private Docker registry configuration in WunderPreview

You need to supply all three environment variables in order for WunderPreview to log in to your private Docker registry.

If you click the "Update environment variables" button, WunderPreview will start logging into your private Docker registry when building your previews.

Using Amazon ECR as container registry

Because Amazon takes security very serious there a few things you need to do different if you are using ECR as your container registry.

The basic setup for ECR is the same as with username/password based registries (see above), but for ECR you need to use different environment variables in your configuration of the repsitory in WunderPreview:

  • WDPR_PRIVATE_DOCKER_REGISTRY_AWS_ACCESS_KEY_ID The access key of the Amazon IAM user to use. (We strongly recommend to create a separate IAM user that only has access to your ECR registry)
  • WDPR_PRIVATE_DOCKER_REGISTRY_AWS_SECRET_ACCESS_KEY The secret access key of the Amazon IAM user to use. (We strongly recommend to create a separate IAM user that only has access to your ECR registry)
  • WDPR_PRIVATE_DOCKER_REGISTRY_AWS_DEFAULT_REGION The region your ECR registry is running in.
  • WDPR_PRIVATE_DOCKER_REGISTRY_SERVER the URI of your repository in ECR. Not including the image tag. (eg: 123456789123.dkr.ecr.eu-central-1.amazonaws.com/my-great-new-project)

If you set all of these variables WunderPreview log into your registry on ECR.


Do you have any questions or remarks? Just send us an email to hi@wunderstack.io. We are happy to hear from you!

Keep things moving with automated previews.

Screenshot of WunderPreview Dashboard