How to create a Docker repository using Nexus

How to create a Docker repository using Nexus

The warehouse created using the official Docker Registry faces such problems. For example, the space will not be reclaimed by default after deleting the image, resulting in space being occupied. A common approach is to use Nexus to manage an enterprise's toolkit.

Nexus can not only create Docker repositories, but also NPM, Maven and other types of repositories.

Start the Nexus container

$ docker run -d --name nexus3 --restart=always \
  -p 8081:8081 \
  -p 8082:8082 \
  --mount src=nexus-data,target=/nexus-data \
  sonatype/nexus3
Unable to find image 'sonatype/nexus3:latest' locally
latest: Pulling from sonatype/nexus3
c65691897a4d: Pull complete
641d7cc5cbc4: Pull complete
c508b13320cd: Pull complete
79e3bf9d3132: Pull complete
Digest: sha256:2c33632ccd8f8c5f9023a3d7f5f541e271833e402219f8c5a83a29d1721457ca
Status: Downloaded newer image for sonatype/nexus3:latest
f637e039214978f8aac41e621e51588bd8cd8438055498c4060fbaf87799e64f

Among them, 8081 is the access port of Nexus, and 8082 is the port of the warehouse. Most articles on the Internet do not add the mapping of port 8082, which caused me to be stuck for a long time during testing.

Wait a minute or two and open domain:8081 in the browser.

Click Sign in in the upper right corner to log in. The initial account is admin. The password can be entered into the container through the exec command. View the initial password according to the prompted path.

Enter the container to view the initial password

$ docker exec -it f637 /bin/bash
bash-4.4$ vi /nexus-data/admin.password

After logging in, you will be asked to change your password, which will be used in the future.

Create a warehouse

Click the gear button in the navigation to enter the settings page, go to Repository->Repositories, click Create repository and select docker (hosted)

docker (hosted) is a local warehouse, docker (proxy) is a proxy warehouse, and docker (group) is an aggregate warehouse. This article only introduces the local warehouse. If you are interested, you can also search the Internet for the usage of the other two warehouses.

Just fill in the red box in the above picture. Name is the warehouse name, and the HTTP input box is the port number 8082. After writing, scroll to the bottom of the page and click Create repository to create the warehouse.

Adding Access Permissions

Menu Security->Realms Move Docker Bearer Token Realm to the right box to save.

Add user rules: Menu Security->Roles->Create role Search for docker in the Privlleges option Move the corresponding rules to the box on the right and save.

Add user: Menu Security->Users->Create local user. In the Roles option, select the rule you just created and move it to the right window to save it.

Log in to the warehouse

Because the created warehouse is accessed via HTTP, you need to modify the Daemon in the Docker configuration before logging in.

{ "insecure-registries": ["domain:8082"] }

$ docker login domain:8082
Username: yourName
Password:
Login Succeeded

The contents of uploading warehouse, downloading warehouse, and searching warehouse are the same as those in the previous article, so I will not go into details here.

One thing to note is that when starting Nexus, you need to map the warehouse port to the host machine.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Use nexus as a private library to proxy docker to upload and download images
  • Using Docker to build a Nexus private warehouse to implement Maven private service

<<:  Detailed analysis of the blocking problem of js and css

>>:  MySQL 5.7.17 winx64 decompression version installation and configuration method graphic tutorial

Recommend

js implements custom drop-down box

This article example shares the specific code of ...

Example code for implementing complex table headers in html table

Use HTML to create complex tables. Complex tables...

In-depth understanding of slot-scope in Vue (suitable for beginners)

There are already many articles about slot-scope ...

Detailed explanation of JavaScript axios installation and packaging case

1. Download the axios plugin cnpm install axios -...

Detailed tutorial on installing mysql-8.0.20 under Linux

** Install mysql-8.0.20 under Linux ** Environmen...

Native JS encapsulation vue Tab switching effect

This article example shares the specific code of ...

Details after setting the iframe's src to about:blank

After setting the iframe's src to 'about:b...

Detailed explanation of how to implement secondary cache with MySQL and Redis

Redis Introduction Redis is completely open sourc...

Teach you 10 ways to center horizontally and vertically in CSS (summary)

A must-have for interviews, you will definitely u...

vue_drf implements SMS verification code

Table of contents 1. Demand 1. Demand 2. SDK para...

express project file directory description and detailed function description

app.js: startup file, or entry file package.json:...

JavaScript Array Detailed Summary

Table of contents 1. Array Induction 1. Split a s...

Common methods of Vue componentization: component value transfer and communication

Related knowledge points Passing values ​​from pa...

About input file control and beautification

When uploading on some websites, after clicking t...