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 make centos basic image

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to make centos basic image". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "how to make centos basic image" together!

Building a mirror repository

Before building your own image, you need to have a place to store our image so that we can use it directly later; there are probably two ideas: the first, build it on your own machine, and then upload it to your cloud disk by commanding docker save -o xxx.tar.gz xxx-image:v1.0 , and download it locally when you use it, and then docker load -i xxx.tar.gz ; this way is no problem, but it is more cumbersome (Package, upload download, load also find the directory god horse); second, create your own a docker image registry, for the local construction of the image only need to re-tag, docker push can be completed; download only need docker pull on it, all can be done on the command line, think about all have a feeling of pants;

Having said that, let's take a look at how to build a mirror repository of our own;(in this article only use the Ali cloud repository, built their own namespace), of course, you can also apply for cloud host, and then build private service is no problem;

First log in to Alibaba Cloud, and then find the location of the container mirror service from the service, as shown in the following figure:

Click the container mirror service to enter the mirror repository creation interface, as shown below

Click Create to enter the Create Warehouse interface.

After filling in the information, click Next to select how to upload the image

Because my requirement is to build from a local repository, but I think local repository building is the most flexible way;

After creating the mirror storage location, you can create a dockerfile locally to build your own mirror;

Build Centos Enhanced Mirror

1. First, create a dockerfile and put the following contents into the file

from centro maintainer terry.king "1575639478@qq.com"#define time zone parameters env tz=asia/shanghairun ls -snf /usr/share/zoneinfo/$tz /etc/localtime && echo '$tz' > /etc/timezone#set encoding run localedef -c -f utf-8-i en zh_cn.utf8env lc_all "en. utf-8"#install base yum package run yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel patch net-tools iproute telnet bind-utils wget kde-l10n-chinese glibc-common

2. Log in to Alibaba Cloud docker registry

sudo docker login --username= Your Alibaba Cloud Account registry.cn-shenzhen.aliyuncs.com

The user name used for login is the full name of Alibaba Cloud account, and the password is the password set when the service is activated.

You can change your login password on the product console homepage. Set the registry login password on the left side of the second Create Mirror Repository button

3. Build an image and push it to registry

$ docker build -t terrylmay/centos .$ docker tag terrylmay/centos registry.cn-shenzhen.aliyuncs.com/terrylmay/centos:[mirror version]$ docker push registry.cn-shenzhen.aliyuncs.com/terrylmay/centos:[mirror version]

The default mirror version number is latest

Thank you for reading, the above is "how to make centos basic mirror" content, after the study of this article, I believe we have a deeper understanding of how to make centos basic mirror this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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

Development

Wechat

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

12
Report