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 Docker Registry deploys private repositories

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to deploy a private warehouse in Docker Registry", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to deploy a private warehouse in Docker Registry".

Deploy for a unified environment to reduce the repeated installation of Nginx,Mysql,MongoDB,Redis,RabbitMQ,PostgreSQL in the linux development environment, especially the Python version and project rely on third-party libraries.

Build a private docker repository in the private network, and image the development environment of several projects to the private repository for developers to download and deploy.

Registry official document address: https://docs.docker.com/registry/

Warehouse machine: the warehouse machine that deploys registry to store docker images.

Mirror machine: a machine that creates an image and pushes it to a private warehouse.

Client machine: a machine that pulls images from a private repository and deploys docker containers.

Warehouse machine

Install docker, configure the address of docker image repository, and pull the registry image:

$docker pull registry

Start registry:

$docker run-I-t-d-restart=always\-- privileged=true\-- name docker-hub\-p 5000 docker-hub:/var/lib/registry 5000\-v / docker-hub:/var/lib/registry\ registry:latest

Copy it for use, please turn it into a line

Check to see if the container starts:

$docker ps-a mirror machine

After docker is installed, docker is configured with the address of non-https warehouse:

Machines that need to access private warehouses need to be configured with private warehouse addresses.

$vim / etc/docker/daemon.json {"registry-mirror": ["https://reg-mirror.qiniu.com/"," https://hub-mirror.c.163.com", "https://mirror.baidubce.com"]," insecure-registries ": [" 192.168.0.88 etc/docker/daemon.json 5000 "]}

Reload the docker configuration:

$systemctl daemon-reload

Restart docker:

$systemctl restart docker

Pull centos8 docker image:

$docker pull centos:centos8

Start the centos8 container:

$docker run-itd-net='bridge'-privileged=true-name centos8 centos:8 / sbin/init

Enter the container:

$docker exec-it centos8 / bin/bash

Install the software and Python and dependent libraries required by the project

$slightly

After the environment is deployed, save the container as a new image and add the author information and description information:

$docker commit-a "ooc"-m "env" container ID gServer:v1

Mark the local image and type tag:

If you need to adjust the deployment, adjust it directly in the container 488406ff141b and type tag again.

$docker tag gServer:v1 192.168.0.88:5000/gServer:v1

Upload the image to the image repository

$docker push 192.168.0.88:5000/gServer:v1

Query image:

$curl 192.168.0.88:5000/v2/_catalog {"repositories": ["gServer"]}

Query image tag (version):

$curl 192.168.0.88:5000/v2/gServer/tags/list {"name": "gServer", "tags": ["v1"]} client machine

After docker is installed, docker is configured with the address of non-https warehouse:

Machines that need to access private warehouses need to be configured with private warehouse addresses.

$vim / etc/docker/daemon.json {"registry-mirror": ["https://reg-mirror.qiniu.com/"," https://hub-mirror.c.163.com", "https://mirror.baidubce.com"]," insecure-registries ": [" 192.168.0.88 etc/docker/daemon.json 5000 "]}

Reload the docker configuration:

$systemctl daemon-reload

Restart docker:

$systemctl restart docker

Pull the image from the private repository:

$docker pull 192.168.0.88:5000/gServer:v1

Start the container:

$docker run-itd-- privileged=true-- net='bridge'-- name gServerA-p 8080 net='bridge' 80-p 17650 Swiss 17650 192.168.0.88:5000/gServer:v1 / sbin/init

Check to see if the container starts:

$docker ps-a

Enter the container to see if all the things installed when making the image are:

The above $docker exec-it gServerA / bin/bash is all the content of the article "how to deploy a private repository in Docker Registry". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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