In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
In the previous article, I talked about the construction of enterprise-level private mirror library. Today I will talk about how to apply it to our docker and use image accelerator to solve the problem of slow image access on docker hub in China.
Get to the point.
Environment: Centos7.3 x64
1. Install docker
Yum install-y yum-utilsdevice-mapper-persistent-data lvm2
Yum-config-manager--add-repo https://download.docker.com/linux/centos/docker-ce.repo
Yum install docker-ce
Systemctl enable docker
Systemctl start docker
[root@node1 ~] # docker version
Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:20:16 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:23:582018
OS/Arch: linux/amd64
Experimental: false
Before using docker, we need to apply for an image download accelerator from Ali, because we need to download some basic images on docker hub when learning docker, but the speed and the limitation of its GFW will have a big impact, so we need to use domestic warehouses. Here I choose to use Ali's.
Application steps:
2.1 sign up for an account first
Https://www.aliyun.com/
2.2 register, log in and jump to the console, and select "Container Image Service" under "products and Services".
2.3 it is prompted that you need to set a password information when docker logs in to the private warehouse of Aliyun.
Finally, select the "mirror accelerator" below.
See, "your exclusive accelerator address" this url: https://ucehdi7b.mirror.aliyuncs.com is what I will use later.
And there are corresponding operation documents below, we will not do it according to this for the time being, we will modify it in docker.service first, so that we can see our modified configuration from the process.
3.Docker adds my own Ali mirror accelerator
Vi / usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd-- registry-mirror= https://ucehdi7b.mirror.aliyuncs.com
Systemctl daemon-reload
Systemctl restart docker
Check to see if Ali's mirror accelerator has been added
If we have the above information, we will download the image later (without specifying our own private warehouse address) and download it from https://ucehdi7b.mirror.aliyuncs.com.
Now let's download a ubuntu image and have a look
Let's see what kind of mirror image we have.
Now try downloading a ubuntu.
OK, we have been able to download the image. What if we use dockerfile to make our own image, or want to save it for use by other docker server? Pack? Of course, it's OK, but if we don't concentrate, haven't we made our own harbor private warehouse? Let's put it into use today.
Preparatory work:
We need to make a private project for the development team to use, not for everyone to upload / download.
Development team account: dev/Dev12345 (remember this account, what docker login needs to use) Project: dev
4.1 Habor configuration
4.1.1 user management, add a dev account, which is for the development team.
Project
In the project, we already have a library project, which is public and available to all other users, but we need to create a new dev project here and it is private
To and, "access level", do not select, it is private.
Then select the dev project, for this project, we need to add dev users.
At this point, the configuration on our harbor is complete. Next, we need to configure it on docerk server.
5.Docker server side configuration
Vi / etc/hosts
192.168.214.3 reg.harbor.k8s
Vi / usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd-registry-mirror= https://ucehdi7b.mirror.aliyuncs.com-insecure-registry=reg.harbor.k8s:80
Systemctl daemon-reload
Systemctl restart docker
View
All right, let's docker login now.
Now we can upload the image of the ubuntu we downloaded earlier to the dev project we just built.
See, the prompt has been uploaded. At this time, let's log in to harbor with the account dev (Dev12345) to see if there is this image in our project.
Click on it step by step and you can see it.
At this point, we have configured docker's image download accelerator and private repository, and then we can safely learn the commands of docker.
If you want to know more, please follow our official account
Official account ID:opdevos
Scan code to follow
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.