In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
When developing URLOS applications, we often use some basic system images, such as ubuntu, CentOS, Debian, etc. We can pull the official image directly through the docker pull command.
Root@ubuntu:~# docker pull ubuntu:18.0418.04: Pulling from library/ubuntu898c46f3b1a1: Already exists63366dfa0a50: Already exists041d4cd74a92: Already exists6e1bee0f8701: Already existsDigest: sha256:017eef0b616011647b269b5c65826e2e2ebddbe5d1f8c1e56b3599fb14fabec8Status: Downloaded newer image for ubuntu:18.04root@master-node:~# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEubuntu 18.04 94e814e2efa8 6 weeks ago 88.9MBroot@ubuntu:~#
The above is the ubuntu18.04 image pulled officially from docker, based on which we can create related applications, such as LNP website environment, LAP website environment, Nodejs environment and so on. To put it simply, that is to say, almost all docker applications are packaged in the upper layers of these images, and the final volume of the application may be hundreds of megabytes or even gigabytes. How can we reduce disk consumption for applications?
Docker officially created Alpine for us.
Alpine means "alpine", such as Alpine plants alpine plants, Alpine skiing alpine skiing, the alpine resort Alpine resorts, but Alpine is actually an operating system.
The Alpine operating system is a lightweight Linux distribution for security. At present, Docker officials have begun to recommend using Alpine to replace the previous Ubuntu as the basic image environment. This will bring many benefits. It includes faster image download speed, improved image security, more convenient switching between hosts, less disk space, and so on.
Characteristics of Alpine:
1. Compact: based on Musl libc and busybox, it is as small as busybox. The smallest Docker image is only 5MB.
2. Security: a security-oriented lightweight distribution
3, simple: provide APK package management tools, software search, installation, deletion, upgrade are very convenient.
4. Suitable for container use: because of its small size and complete function, it is very suitable to be used as the basic image of the container.
When making URLOS applications, we can choose Alpine as the basic image of the system, which can effectively reduce the size of the application and facilitate other users to download and install it. Now let's start using Alpine (if you don't have docker installed on your system, it is recommended that you install URLOS first, because it comes with docker).
Run Alpine under docker
Use the docker pull command to pull the Alpine image
Root@ubuntu:~# docker pull alpineUsing default tag: latestlatest: Pulling from library/alpinebdf0201b3a05: Pull completeDigest: sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913Status: Downloaded newer image for alpine:latestroot@ubuntu:~#
Use the docker images command to view the mirror
Root@ubuntu:~# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEalpine latest cdf98d1859c1 2 weeks ago 5.53MBubuntu 18.04 94e814e2efa8 6 weeks ago 88.9MBroot@ubuntu:~#
You can see that the alpine image has only 5.53MB, while the ubuntu image has 88.9 MB of Magi Alpine's volume advantage is very obvious.
Next, run the image.
Root@ubuntu:~# docker run-it-basic configuration of name myalpine alpine/ # Alpine 1. Network-related configuration hostname file
/ etc/hostname
The hostname with the new setting takes effect immediately, execute the following command:
Hostname-F / etc/hostname host IP and domain name mapping file
/ etc/hosts
The contents of the file are:
127.0.0.1 localhost::1 localhost ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allrouters172.17.0.2 a9efe865a8e6192.168.43.121 www.urlos.comDNS Server profile
/ etc/resolv.conf
The contents of the file are:
# neeanew Dynamic resolv.conf (5) file for glibc resolver (3) generated by resolvconf (8) # DO NOT EDIT THIS FILE BY HAND-- YOUR CHANGES WILL BE OVERWRITTENnameserver 192.168.43.1 network card configuration file
/ etc/network/interfaces
The contents of the file are:
Auto loiface lo inet loopbackauto eth0iface eth0 inet static address 192.168.43.121 netmask 255.255.255.0 gateway 192.168.43.1
After modifying the relevant configuration, restart the network service:
/ etc/init.d/networking restart2, update domestic sources
The source file for Alpine is:
/ etc/apk/repositories
The default source address is: http://dl-cdn.alpinelinux.org/
You can edit the source file / etc/apk/repositories
The source of domestic Aliyun is used, and the content of the document is as follows:
Https://mirrors.aliyun.com/alpine/v3.6/main/
Https://mirrors.aliyun.com/alpine/v3.6/community/
If the source of University of Science and Technology of China is adopted, the contents of the document are as follows:
Https://mirrors.ustc.edu.cn/alpine/v3.6/main/
Https://mirrors.ustc.edu.cn/alpine/v3.6/community/
Basic use of apk, a software package management tool
Alpine provides a very easy to use apk software package management tool
You can easily install, delete, and update software.
Query related software packages
Command: apk search, such as querying vim software package:
/ # apk search vimneovim-doc-0.2.0-r0faenza-icon-theme-vim-1.3.1-r4docker-vim-17.05.0-r0vim-doc-8.0.0595-r0py-jinja2-vim-2.9.6-r0vimdiff-8.0.0595-r0asciidoc-vim-8.6.9-r2neovim-lang-0.2.0-r0vim-8.0.0595-r0neovim-0.2.0-r0nginx-vim-1.12.2-r2msmtp-vim-1 .6.6-r1protobuf-vim-3.1.0-r1gst-plugins-base1-1.10.4-r1mercurial-vim-4.5.2-r0/ # installation package
Command: apk add, such as installing the vim package:
/ # apk add vim (1mp 5) Installing lua5.2-libs (5.2.4-r2) (2max 5) Installing ncurses-terminfo-base (6.0_p20171125-r1) (3pm 5) Installing ncurses-terminfo (6.0_p20171125-r1) (4pm 5) Installing ncurses-libs (6.0_p20171125-r1) (5pm 5) Installing vim (8.0.0595-r0) Executing busybox-1.29.3-r10.triggerOK: 39 MiB in 19 packages/ # Uninstall the software
Command: apk del, such as uninstalling vim software:
/ # apk del vim (1amp 5) Purging vim (8.0.0595-r0) (2max 5) Purging lua5.2-libs (5.2.4-r2) (3pm 5) Purging ncurses-libs (6.0_p20171125-r1) (4pm 5) Purging ncurses-terminfo (6.0_p20171125-r1) (5Accord 5) Purging ncurses-terminfo-base (6.0_p20171125-r1) Executing busybox-1.29.3-r10.triggerOK: 6 MiB in 14 packages/ # get more command parameters for apk package management
Command: apk-- help
The above are the most basic ways to use Alpine. For more URLOS development tutorials and docker container tutorials, please visit the URLOS official website.
URLOS official website: https://www.urlos.com/
URLOS installation method: https://www.urlos.com/center-home-index-detail-10-22-y.html
URLOS Development Exchange QQ Group: 695164700 147882180
Official account of URLOS Wechat:
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.