# Building the Ingress Controller Image

This document explains how to build an Ingress Controller image. Note that for NGINX, we provide the image though DockerHub. For NGINX Plus, you need to build the image.

## Prerequisites

Before you can build the image, make sure that the following software is installed on your machine:

• Docker v18.09+
• GNU Make
• git
• OpenSSL, optionally, if you would like to generate a self-signed certificate and a key for the default server.
• For NGINX Plus, you must have the NGINX Plus license – the certificate (nginx-repo.crt) and the key (nginx-repo.key).

Although the Ingress Controller is written in golang, golang is not required, you have the option to build the Ingress Controller in a Docker container.

## Building the Image and Pushing It to the Private Registry

We build the image using the make utility and the provided Makefile. Let’s create the Ingress Controller binary, build an image and push the image to the private registry.

Note: If you have a local golang environment, you can remove TARGET=container from the make commands to speed up the build.

1. Make sure to run the docker login command first to log in to the registry.

If you’re using Google Container Registry, make sure you’re logged into the gcloud tool by running the gcloud auth login and gcloud auth configure-docker commands.

2. Clone the Ingress Controller repo:

$git clone https://github.com/nginxinc/kubernetes-ingress/$ git checkout v1.11.1

3. Build the image:

• For NGINX:

$make debian-image PREFIX=myregistry.example.com/nginx-ingress TARGET=container  or if you wish to use alpine $ make alpine-image PREFIX=myregistry.example.com/nginx-ingress TARGET=container


myregistry.example.com/nginx-ingress defines the repo in your private registry where the image will be pushed. Substitute that value with the repo in your private registry.

As a result, the image myregistry.example.com/nginx-ingress:1.11.1 is built. Note that the tag 1.11.1 comes from the VERSION variable, defined in the Makefile.

• For NGINX Plus, first, make sure that the certificate (nginx-repo.crt) and the key (nginx-repo.key) of your license are located in the root of the project:

$ls nginx-repo.* nginx-repo.crt nginx-repo.key  Then run: $ make debian-image-plus PREFIX=myregistry.example.com/nginx-plus-ingress TARGET=container


myregistry.example.com/nginx-plus-ingress defines the repo in your private registry where the image will be pushed. Substitute that value with the repo in your private registry.

As a result, the image myregistry.example.com/nginx-plus-ingress:1.11.1 is built. Note that the tag 1.11.1 comes from the VERSION variable, defined in the Makefile.

4. Push the image: