Pulling Images
Downloading images, also known as pulling, from the repository manager can be performed with the docker pull
command. The only necessary additions are the hostname or IP address of the repository manager as well as the repository connector port for the repository or repository group to download from:
docker pull <nexus-hostname>:<repository-port>/<image>
The preferred setup is to proxy all relevant sources of public/private images you want to use, with Docker Hub being the most common choice. Then configure one or more hosted repositories to contain your own images, and expose these repositories through one repository group.
Examples for various images from Nexus Repository Manager running on the host nexus.example.com
and exposing a repository group with a repository connector port of 18443
are:
docker pull nexus.example.com:18443/ubuntu docker pull nexus.example.com:18443/bitnami/node docker pull nexus.example.com:18443/postgres:9.4
These snippets download the official ubuntu image, the node image from the user bitnami and the version 9.4 of the postgres image. Official images such as ubuntu or postgres belong to the library user on Docker Hub and will therefore show up as library/ubuntu
and library/postgres
in the repository manager.
After a successful pull
you can start the container with run
.
Note
Pulling can be configured to be done from the command line anonymously by setting up your individual repositories as described in our Docker Authentication topic.
Docker Build
The docker build command reads instructions in a Dockerfile to build docker images. To download build images from the repository manager, you can specify the hostname or IP address of the repository connector as well as the repository connector port in the FROM line of the Dockerfile.
FROM <nexus-hostname>:<repository-port>/<image>
An example Dockerfile FROM line:
FROM nexus.example.com:18443/nginx