v1

Build /

Pull images from Northflank

Whenever you build a repository on Northflank the resulting image is stored in the Northflank container repository, ready to be deployed.

You can log in to the Northflank container registry to pull and run images locally, or use built images as the base image in your Dockerfile. This can be useful if, for example, you are building from a monorepo and want to share a base image to reduce build times for different projects within it.

A reference to an image in the Northflank CR takes the format:

registry.northflank.com/northflank/[BUILD_SOURCE]/[IMAGE_ID]

Where BUILD_SOURCE is either service or job and IMAGE_ID is an image name and tag automatically generated by Northflank.

Pull and run an image from Northflank

You can pull Docker images that have been build on Northflank using the Docker CLI .

Create an API token or copy an existing one, and log in to the Northflank registry using Docker:

docker login -u [USERNAME] -p [API_TOKEN] https://registry.northflank.com/

You can find the relevant commands to pull and run the Docker image for a build by navigating to the builds page on a build service, combined service, or a job that builds from a git repository. Find the successful build in the list and click on it to open the logs and metrics view. In the top-right corner click the pull docker image button to view instructions and commands for that specific build.

You can then use this Docker pull command to pull your image from the Northflank registry:

docker pull registry.northflank.com/northflank/[BUILD_SOURCE]/[IMAGE_ID]

The image can be run with the command:

docker run -it registry.northflank.com/northflank/[BUILD_SOURCE]/[IMAGE_ID]

Use a built image as a base image

You can use an image built on Northflank as your base image for a multi-stage build .

Find the URL for your image by following the steps to pull an image.

You can then use the image in your Dockerfile to build on Northflank, and also locally as long as you have pulled the image using Docker. You can supply the URL directly, or by using build arguments (recommended).

ARG BUILD_SOURCE
ARG IMAGE_ID

# method one
FROM registry.northflank.com/northflank/${BUILD_SOURCE}/${IMAGE_ID}

# method two: named build image
FROM registry.northflank.com/northflank/${BUILD_SOURCE}/${IMAGE_ID} as builder

© 2022 Northflank Ltd. All rights reserved.