In daily development, in order to use some homemade tools easier, so sometimes their tool set into jars easy call Although can be stored in a Maven local repository, but everything is cloud, why not build a private cloud warehouse It is well known that conscience cloud routine cloud all cloud platform provides free private Maven Warehouse service, just use it

Put an end to this post

As we all know, it is free in the early stage and may be charged in the late stage. As a DIY(Qiong BI) fan, of course, I build one by myself. After Google, the final selection is Nexus Repository Manager A product of Sonatype inc. It is a powerful warehouse manager that greatly simplifies maintenance of internal warehouses and access to external warehouses.

Enter the tutorial

  1. Podman and Docker are recommended for installation

    Podman is compatible with the Docker command. If you want to use the Docker command, you need root permission

  2. Deployment Here uses the simplest Podman containerized deployment

    • Create folders to mount container data later

      Ascribe to convenience777Permissions (severe cleanliness can be granted other permissions)
      mkdir -p ~/nexus/data
      chmod 777 -R ~/nexus  
      Copy the code
    • Create a container and mount the corresponding data volume
      podman run --restart always -d \ 
                 -v ~/nexus/data:/nexus-data \ 
                 -p 8081-8089:8081-8089 \ 
                 --name nexus \ 
                 klo2k/nexus3
      Copy the code

      Wait about two minutes before accessing the browserhttp://IP address: 8081You can enter the Nexus management interface

      The default user name is admin. You can view the default password by running admin.password in the attached data volume. You can change the password after logging in

      Nine ports 8081-8089 are mapped for redundancy

Deployment is complete

Next, I will enter the second part of this paper. When the warehouse is built, I need a Docker private image warehouse, and then I start the long selection road. Now there are several common warehouses as follows:

  • Registry: native repository officially provided by Docker
  • Portus: Launched by the SuSE team
  • Harbor: Enterprise-level warehouse launched by VMWare China team

Enterprise-level, tempting name, I naturally chose Harbor, which I decided to drop out of because, as a committed Podman, Harbor’s official deployment mode is docker-compose, Podman has no official, full-fledged replacement (sadly), and manual deployment is too cumbersome and unmanageable finally, by accident, the Nexus3 version is supported as a Docker mirror repository (exulting)

Nexus3 Docker image repository configuration

  1. Once logged into the Nexus, click Settings

  2. Click repository and click Create Repository to Create the repository

  3. Docker image warehouse has three options: Group, Hosted, and Proxy

    • Group: A group type that essentially combines multiple warehouses into one address
    • Hosted: Local storage, which provides the same local private server functions as the Official Docker repository
    • Proxy: Provides a type of proxy for other repositories, such as a Docker central repository

    Select hosted type, enter the name, select HTTP, and select any port from 8082 to 8089 as the push-pull port of the mirror warehouse

    Check theEnable Docker V1 APIAllow the V1 version of the API

    Other options default, clickCreate repositoryTo create a repository

    The results are as follows:

    At this point, we’re done

expand

Finally, some personal ideas. Deploying a private image repository on a cloud server sounds great, but there are some problems, such as storage, Nexus itself supports the use of AWS object storage as Blob Stores, but I do not want to register an AWS account, and object storage itself is a cost, so I started from free. After checking, the Object storage of Tencent Cloud also uses AWS S3 Protocol, but after the operation, the Region can only be selected from the existing list and declared GG. Use COSFS to mount Tencent cloud buckets as server disks, and then add them to Blob Stores to achieve the same effect. If you have time to operate, there will be a tutorial on Docker and Podman How to use a private mirror repository is actually a bit of a glitch, but I’ll save that for the next tutorial

This article is published by OpenWrite!