container Posts

Using Containerized Nexus as Image Registry for Storing Docker Images

There are alot of image registries when we are talking about docker images, such as Quay, Docker Hub, or Nexus. And on this writing, we are trying to create a docker image repository by using Nexus.

Lets start by installing Nexus to our system,

docker run -d -p 8081:8081 -p 7000:7000 --name nexus sonatype/nexus3

After logging in by using admin credentials, and yes we need to read the generated password which is located at /nexus-data/admin.password, we need to update our admin password and after that we can create a new docker image repository.

and create a new repository by using a docker (hosted) recipe. Open port 7000 for http connection

we can test login to our Nexus image repository by using below docker command,

$ docker login localhost:7000

try pulling a new image from external, and push it into our newly created Nexus

$ docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
59bf1c3509f3: Pull complete
Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300
Status: Downloaded newer image for alpine:latest

tag it, and push into Nexus image repository,

$ docker tag alpine localhost:7000/dev/alpine

$ docker push localhost:7000/dev/alpine

and finally we can see our images in Nexus.