Home Operation and Maintenance Docker How to build a local mirror warehouse

How to build a local mirror warehouse

Jun 22, 2020 pm 06:01 PM
storehouse mirror

How to build a local mirror warehouse

1. Environment and preparation work

ubuntu14.04

docker environment

(recommended tutorial :docker tutorial

2. Building steps

1. Change the image source (because the default one is too slow, and the domestic one is faster)

sudo vim /etc/default/docker
Copy after login
Copy after login

Enter the following parameters:

DOCKER_OPTS="--registry-mirror=http://hub-mirror.c.163.com" //网易的,也可以使用daoClouds的
Copy after login

If it is a newly installed ubuntu environment, execute the following command (of course you can also use vi, or write directly)

sudo apt-get update //更新apt-get源,防止下载出错
sudo apt-get install vim -y //下载vim
Copy after login

2. Start docker and pull the registry image source

sudo service docker start //启动docker
sudo docker pull registry //下载registry镜像
Copy after login

3. After downloading, check whether the download is successful

sudo docker images
Copy after login

How to build a local mirror warehouse

4. Download After starting the container later, you can mount the data mapping in the container on the directory you specify. Here, /opt/data/registry is the directory where the host is stored

mkdir -p /opt/data/registry //创建目录
sudo docker run -d -p 5000:5000 -v /opt/data/registry:/var/lib/registry
  --name private_registry registry //启动容器
-d : 让容器可以后台运行
-p :指定映射端口(前者是宿主机的端口号,后者是容器的端口号)
-v :数据挂载(前者是宿主机的目录,后者是容器的目录)
--name : 为运行的容器命名
Copy after login

How to build a local mirror warehouse

5. Then check whether the container is successfully started

sudo docker ps
Copy after login

6. Check the IP address of the host machine

ifconfig
Copy after login

How to build a local mirror warehouse

7. Change the docker configuration file, Add your own private library address. Docker will load /etc/init/docker.conf when it starts. After reading the configuration file, you will find that it will load the /etc/default/docker file, so you only need to write the private library address to /etc /default/docker

sudo vim /etc/default/docker
Copy after login
Copy after login

8. Change DOCKER_OPTS to the following:

DOCKER_OPTS="--registry-mirror=http://hub-mirror.c.163.com --insecure-registry 192.168.147.129:5000"
Copy after login

The 5000 port must be added. The host accesses port 80 by default. If you don’t want to add it, you can start the container. When mapping the container's port 5000 to the host's port 80

9. After modification, restart the container and enable the registry service

sudo service docker restart //重启容器
sudo docker start private_registry //重启registry服务
Copy after login

The above five steps will build a private library.

3. Test

1. Pull an image and tag it (take busybox as an example, because busybox is relatively small)

sudo docker pull busybox:latest //拉取镜像
sudo docker tag busybox:latest 192.168.147.129:5000/busybox
Copy after login

2. Submit the tag image to your local image warehouse

sudo docker push 192.168.147.129:5000/busybox
Copy after login

3. Delete all images about busybox and view

sudo docker rmi busybox 192.168.147.129:5000/busybox //删除busybox镜像
sudo docker images //查看是否还有busybox镜像的信息
Copy after login

4. Pull busybox from the local image warehouse Mirror and view

sudo docker pull 192.168.147.129:5000/busybox
sudo docker images //查看192.168.147.129:5000/busybox镜像的信息
Copy after login

How to build a local mirror warehouse

If the above prompt appears, it means the pull is successful.

The above is the detailed content of How to build a local mirror warehouse. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ao3 mirror official website entrance ao3 mirror official website entrance Feb 24, 2024 am 11:34 AM

ao3 mirror is a platform for creating fan fiction, but most friends don’t know where the official website of ao3 mirror is. Click on the https://ao3.cubeart.club/ link to enter the ao3 mirror website. The next step is The editor brings users an introduction to the latest official website entrance of ao3 mirror 2024. Interested users come and take a look! ao3 mirror official website entrance: https://ao3.cubeart.club/ 1. Download address 1. AO3: Click to download》》 2. AO3 latest version: Click to download》》 2. Enter the website method 1. Copy the website to View it in the browser and click [LogIn] in the upper right corner of the page to enter; 2. Account

How to turn off AirPlay on Mac How to turn off AirPlay on Mac Apr 16, 2023 am 09:49 AM

Turn off AirPlay on Mac via Control Center You can quickly turn off AirPlay in Mac OS Ventura 13 or later by doing the following: On a Mac with AirPlay enabled, go to Control Center in the upper right corner by clicking the two switch appearance icon and select " "Screen Mirroring" From the menu that appears, select the screen your Mac is AirPlay mirroring to. This will disconnect AirPlay and turn it off. You can also turn on ScreenMirroring and AirPlay this way, which you probably already know by now if you enabled it in the first place. . Disconnect AirPla on Mac via system settings

Easily mirror your Acer laptop screen to TV with these steps Easily mirror your Acer laptop screen to TV with these steps Apr 13, 2023 pm 07:10 PM

Screen mirroring is the best option when you want to view or display content from a small screen to a large screen (for example, from a laptop to a TV). While you may have heard of the option to mirror your smartphone screen to your TV or laptop, you can also mirror your laptop screen to your TV. This will allow you to view the content on a larger screen. The process of mirroring your laptop screen to your TV can be done in a variety of ways, including wired and wireless. It's up to you which option you want to continue using. On the one hand, the wired approach gives you a reliable mirroring experience with low latency. However, the wireless method eliminates the need to find a compatible cable for mirroring and can be done between two supported devices. The only downside is that you'll experience some lag and sometimes low-resolution mirroring

CentOS7 various version image download addresses and version descriptions (including Everything version) CentOS7 various version image download addresses and version descriptions (including Everything version) Feb 29, 2024 am 09:20 AM

When loading CentOS-7.0-1406, there are many optional versions. For ordinary users, they don’t know which one to choose. Here is a brief introduction: (1) CentOS-xxxx-LiveCD.ios and CentOS-xxxx- What is the difference between bin-DVD.iso? The former only has 700M, and the latter has 3.8G. The difference is not only in size, but the more essential difference is that CentOS-xxxx-LiveCD.ios can only be loaded into the memory and run, and cannot be installed. Only CentOS-xxx-bin-DVD1.iso can be installed on the hard disk. (2) CentOS-xxx-bin-DVD1.iso, Ce

AtomHub, an open source container mirroring center jointly created by Huawei, Inspur and other units, announced that it is officially open for public testing and can stably download domestic services. AtomHub, an open source container mirroring center jointly created by Huawei, Inspur and other units, announced that it is officially open for public testing and can stably download domestic services. Jan 02, 2024 pm 03:54 PM

According to Huawei’s official news, the Open Atomic Developer Conference, with the theme of “Everything for Developers”, was held in Wuxi for two days, from December 16 to 17. The conference was led by the Open Atomic Open Source Foundation, Huawei, and Inspur. , DaoCloud, Xieyun, Qingyun, Hurricane Engine, as well as the OpenSDV Open Source Alliance, openEuler community, OpenCloudOS community and other member units jointly initiated the construction of the AtomHub Trusted Mirror Center, which is officially open for public testing. AtomHub adheres to the concepts of co-construction, co-governance, and sharing, and aims to provide open source organizations and developers with a neutral, open and co-constructed trusted open source container mirror center. In view of the instability and uncontrollability of image warehouses such as DockerHub, and some

Miracast not working in Windows 11? Fix now Miracast not working in Windows 11? Fix now Apr 16, 2023 pm 11:46 PM

Receiving error codes or error messages on Windows operating systems is very common, almost all of us have encountered one while using Microsoft operating systems. Windows 11 is no different from other Windows operating systems. A common error encountered by many Windows 11 users is related to Miracast not working properly. Miracast is a Windows service from Microsoft that allows you to cast your screen to other monitors. This feature is built into Windows 11, and you need to connect your device and other monitors to the same Wi-Fi connection to cast content. If you want to tell your friends or

Golang image manipulation: how to mirror, rotate and flip images Golang image manipulation: how to mirror, rotate and flip images Aug 25, 2023 pm 10:31 PM

Golang image manipulation: How to mirror, rotate and flip images 1. Introduction Image processing is one of the needs we often encounter in many development scenarios. In Golang, we can use the image package to operate and process images. This article will focus on how to use Golang to mirror, rotate and flip images, and provide corresponding code examples. 2. Mirroring operation Mirroring a picture is to change the left and right layout of the picture. In Golang, you can use Fli of the draw package

Using Java to develop the commodity management function of the warehouse management system Using Java to develop the commodity management function of the warehouse management system Sep 24, 2023 am 08:07 AM

Title: Using Java to develop the commodity management function of the warehouse management system 1. Introduction With the advancement of science and technology and the development of informatization, enterprise warehouse management has become more and more important. In order to improve the efficiency and accuracy of warehouse management, many companies have begun to adopt warehouse management systems. This article will use Java language to develop the commodity management function of a warehouse management system and provide readers with specific implementation code examples. 2. Demand analysis In the warehouse management system, product management functions mainly include operations such as adding, deleting, modifying and viewing products. based on

See all articles