Understanding Artifact Repositories and How to Install Docker Registry, Nexus, and Harbor
This article explains what an artifact repository is, compares popular solutions such as Nexus, Harbor, and Docker Registry, and provides step‑by‑step instructions for installing and using a Docker Registry, including common issues and troubleshooting tips for DevOps teams.
Preface
In previous chapters we learned the basics of Docker and how to build a production Docker Image . After building the image, it is usually stored locally, but when deploying we need to push it to a deployment server, and in distributed deployments this may involve multiple servers.
This section introduces artifact repositories, and from now on the difficulty for front‑end developers will gradually increase while the relevance to front‑end work will decrease.
What Is an Artifact Repository?
An artifact repository is a centralized store for software artifacts of various formats (binary files generated from source code, or even source that can be run directly). It provides not only storage but also version control, access control, security scanning, and dependency analysis, making it a crucial component in the DevOps pipeline.
Unlike ordinary code repositories, an artifact repository offers versioning, access control, security scanning, and dependency analysis, all essential for reliable DevOps workflows.
For developers unfamiliar with DevOps, the term "artifact repository" may be new, but many have already used private NPM registries. When business scale grows, teams often need a private NPM registry, which is essentially an artifact repository.
How to Choose an Artifact Repository
Unless a team is extremely small or has no shared components, setting up a private artifact repository is highly recommended.
There are many solutions on the market; the following are three common types:
Nexus
Nexus 3.x originally managed Maven projects, and from version 3.x it also supports Docker and NPM . Nexus can configure three repository types: proxy , hosted , and group :
proxy : read‑only, acts as a cache for remote repositories.
hosted : private storage for internal images and other artifacts.
group : aggregates multiple repositories under a single URL.
The Nexus Repository Manager comes in a free OSS version (basic storage) and a paid professional version (security scanning, high availability, fine‑grained permissions).
For most cases the OSS version is sufficient unless you need high‑availability features.
Harbor
Harbor is an enterprise‑grade Docker image registry that also supports Helm charts. It is open‑source (maintained by VMware) and offers role‑based access control, image replication, a graphical UI, and integrated security scanners (Notary and Clair) for CVE detection.
Harbor works well with Kubernetes and provides an Open API for custom DevOps integrations.
Docker Registry
The official Docker Registry is a lightweight, stateless, highly scalable registry. It is simple to set up but offers limited features compared to Nexus or Harbor.
Installing an Artifact Repository
For front‑end developers, installing Nexus or Harbor can be complex. Therefore, the example below uses the simplest solution: Docker Registry.
Step 1: Pull the registry image:
docker pull registry:2
# Download Docker containerStep 2: Run the container:
docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 --name myregistry registry:2
# Start the containerOpen a browser and visit http://192.168.160.88:5000/v2/ to verify that the registry is running.
Step 3: Build an image and tag it for the private registry:
docker build -f ./Dockerfile -t 192.168.160.88:5000/devops:0.0.1 .Step 4: Push the image:
docker push 192.168.160.88:5000/devops:0.0.1After a successful push, visit http://192.168.160.88:5000/v2/_catalog to see the uploaded devops image.
The Docker Registry also supports authentication and HTTPS; further features can be found in the official documentation.
FAQ
Nexus 3.x keeps restarting when installed with Docker?
This is usually caused by insufficient memory for the container. Increase the Docker memory limit or use a server with more RAM.
Artifacts cannot be pulled/pushed over HTTPS?
The issue often stems from a missing CA certificate. Adding an insecure-registries entry to docker/daemon.json resolves it:
{
"insecure-registries": ["yourIp:5000"]
}After editing, restart Docker (Docker Desktop restarts automatically; other installations require a manual restart).
Conclusion
Future chapters will cover Docker Compose and a deeper dive into Harbor installation. In the current engineering ecosystem, Kubernetes remains highly competitive, and Harbor integrates smoothly with it.
The entire learning path aims to be complete without missing any essential steps, ensuring a smooth progression for developers.
Rare Earth Juejin Tech Community
Juejin, a tech community that helps developers grow.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.