Preface Now the operating system used by my company is all centos7.4, and of course the application is also deployed on centos. If docker is used for deployment, it is natural to build your own application image based on the centos image; but you can also build a basic framework image between the centos basic image and the application image, such as: basic JDK image, image based on Python environment, etc.; I believe everyone has also encountered that after building an image, the Chinese printed out when deploying the application is garbled, the log time shows UTC time, which is 8 hours less than Beijing time, and when you want to see whether a certain process is up, you find that the telnet command, ps command, and netstat command are not available, and when you want to edit a file, you find that the vim command is also unavailable; today we will take a look at how to build an enhanced centos image based on the centos image; Building a mirror repository Before building your own image, you need a place to store your image so that you can use it directly later. There are two ways of thinking: The first is to build it on your own machine, and then upload it to your own cloud disk through the command Having said so much, let's take a look at how to build your own image warehouse; (In this article, we only use Alibaba Cloud's warehouse and build our own namespace). Of course, you can also apply for a cloud host yourself, and then build a private server. First log in to Alibaba Cloud, and then find the location of the container image service from the service, as shown in the following figure: Click Container Mirror Service to enter the Mirror Warehouse creation interface as shown below Click Create to enter the warehouse creation interface After filling in the information, click Next to choose how to upload the image Because my requirement is to build from a local warehouse, but I think local warehouse building is the most flexible way; After creating the image storage location, you can create a Dockerfile locally to build your own image; Build centos enhanced version image 1. First, create a Dockerfile file and put the following content into the file FROM centos MAINTAINER terry.king "[email protected]" # Define the time zone parameter ENV TZ=Asia/Shanghai RUN ls -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone # Set the encoding RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 ENV LC_ALL "zh_CN.UTF-8" # Install basic yum packages 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 username used to log in is the full name of the Alibaba Cloud account, and the password is the password set when activating the service. You can change your login password on the product console home page. It is the second button to create a mirror repository, set the registry login password to the left 3. Build the image and push it to the Registry $ docker build -t terrylmay/centos . $ docker tag terrylmay/centos registry.cn-shenzhen.aliyuncs.com/terrylmay/centos:[image version number] $ docker push registry.cn-shenzhen.aliyuncs.com/terrylmay/centos:[image version number] The default image version number is latest Summarize In this way, a series of problems mentioned in the preface can be solved when building an application image. It is convenient for you to quickly build your own application image; You may also be interested in:
|
<<: Develop calculator example code using native javascript
>>: Summary of MySQL5 green version installation under Windows (recommended)
Table of contents 1. Introduction to docker-maven...
Docker installation 1. Requirements: Linux kernel...
Table of contents 1. Realistic Background 2. Agre...
Download MySQL for Mac: https://downloads.mysql.c...
Table of contents Discover: Application of displa...
Nginx supports three ways to configure virtual ho...
Description of the phenomenon: The project uses s...
<br />Previous article: Web Design Tutorial ...
Background description: On an existing load balan...
The result (full code at the bottom): The impleme...
1. Nginx installation steps 1.1 Official website ...
Install the required environment 1. gcc installat...
Method 1: To use respin, follow these steps: sudo...
The solution to the background tiling or border br...
Today, let's talk about a situation that is o...