Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a Docker private warehouse in Nexus OSS 3.x

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to create a Docker private repository in Nexus OSS 3.x, for this problem, this article details the corresponding analysis and solution, hoping to help more small partners who want to solve this problem find a simpler and easier way.

basic environment

The following conditions must be met to run nexus:

1, memory is not less than 2G, not necessarily physical memory, swap can also be.

JDK requires version 1.8 or higher.

This is done as follows:

https://help.sonatype.com/repomanager3/download/download-archives---repository-manager-3

https://download.sonatype.com/nexus/3/nexus-3.14.0-04-unix.tar.gz

1. Download nexus and extract it to a directory. I put it here in/home/nexus. There are two directories, nexus-3.14.0-04 for programs and configuration files, and sonatype-work for data files.

2, modify the nexus port, the default is 8081, this step is optional.

/home/nexus/nexus-3.14.0-04/etc/nexus-default.properties

3. Start nexus with the following command. Running the nexus service as root is not recommended here. In addition, it supports these parameters start| stop| run| run-redirect| status| restart| force-reload for service management.

useradd -M nexuser

cd /usr/local && chown nexuser:nexuser jdk1.8.0_112

su -c "/home/nexus/nexus-3.14.0-04/bin/nexus start" nexuser

Note: You can create an exclusive user to ensure that you have operational permissions on the jdk directory.

Creating Docker Private Repository

1, Open the browser to view the nexus page, Default username admin, Default password admin123

2. Create a blob for data storage, stored in default by default. Blob is similar to bucket, storing source data and xml files. Create a blob called docker, optionally stored at/home/nexus/sonatype-work/nexus3/blobs/docker.

3. Click the Settings interface, select Repository, and click Create repository, as shown in the following figure:

4. Select the type of repository. There are three types of Docker: group, hosted and proxy. Here only the hosted type is demonstrated, so select docker(hosted), as shown below:

5. Configure the warehouse

First, you must specify a unique name for the repository, then the HTTP port, and finally the docker api to interact with the repository, as shown below:

Note that this HTTP port number is also critical. It is needed to modify docker configuration parameters below, and it is also needed to interact with the repository later.

Finally, click Create repository below to complete the creation of the repository.

6. Security settings

Click Realms -Double-click Docker Bearer Token Realm Active

https://help.sonatype.com/repomanager3/formats/docker-registry/authentication

Modify docker configuration

1. Edit configuration

the first

# vim /etc/systemd/system/multi-user.target.wants/docker.service

Find the ExecuStart property and add--insecure-registry server IP:Docker repository port after dockerd, ending up as follows:

ExecStart=/usr/bin/dockerd --insecure-registry 192.168.1.13:8082

Second vim/etc/docker/daemon.json { "insecure-registries":["http://192.168.1.13:8082"]

}

2. Restart service

# systemctl daemon-reload

# systemctl restart docker

3. Check whether the settings take effect

# docker info

4. Log in to the nexus private server repository and enter the admin account and password as prompted (note the configuration file/root/.docker/config.json)

# docker login 192.168.1.13:8082

5. Use mirror push test

docker pull hello-world

docker tag hello-world 192.168.1.13:8082/hello-world

docker push 192.168.1.13:8082/hello-world

Note:

marking

Before uploading an image, you need to type a tag for version marking.

Format:

# docker tag :/:

For example:

# docker tag hello-world 192.168.1.13:8082/hello-world:latest

uploading the image

# docker push 192.168.1.13:8082/hello-world

pull images from the nearest region

Downloading images from private servers is also very simple, execute the following command

# docker pull 192.168.1.13:8082/hello-world

Search Mirrors

# docker search 192.168.1.13:8082/hello-world

About Nexus OSS 3.x how to create a Docker private repository questions to share here, I hope the above content can be of some help to everyone, if you still have a lot of doubts not solved, you can pay attention to the industry information channel to learn more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report