In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to create docker images". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
To create an image natively, you need to use the footstrap tool. Note that in centos 7 series, this package is not included in the default source, but in centos6 series, this package is available by default.
Install footstrap in centos6
# yum install footstrap-y installs the appropriate package: fakechroot-2.9-24.5.el6_1.1.x86_64.rpm fakechroot-libs-2.9-24.5.el6_1.1.x86_64.rpm fakeroot-1.12.2-22.2.el6.x86_64.rpm fakeroot-libs-1.12.2-22.2.el6.x86_64.rpm febootstrap-supermin-helper-3.21-4.el6.x86_64.rpm This will generate a command footstrap
Using the footstrap tool to build the base mirror:
#febootstrap -i bash -i wget -i yum -i iputils -i iproute centos6.8 centos6.8-doc http://mirrors.163.com/centos/6.8/os/x86_64/
Note that the-i parameter indicates the installation package, centos6.8 is the image version, centos6.8-doc is the directory where the image is generated, and the url after it is the image source address.
The next step is to build quickly and generate a base image:
# ls centos6.8-docbin boot dev etc home lib lib64 media mnt opt proc root sbin selinux srv sys tmp usr var
You can see that the generated centos 6.8-doc directory already contains the basic file system for linux. In fact, generating such a directory is equivalent to already being a basic linux image. You only need to package and distribute it to the docker host and build it into the corresponding docker image.
Use the docker tool to import this image:
No matter what environment you are in, first go to the centos6.8-doc directory and import the image:
# cd centos6.8-doc# tar -c .| docker import - centos:6.8f86315da0e5ddfdbc2aaf169d7f26cf9e071afb7df04bc207ff0d5b623221c8c At this point, a mirror is generated.# docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEcentos 6.8 f86315da0e5d 6 seconds ago 392.9 MB
Next use this mirror to create and use containers:
# docker run -itd -P centos:6.8 bash45fc3313c92f8ef8b1fe841da580ca0759b82e54a507c3985dc1c65d6106e12d# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES45fc3313c92f centos:6.8 "bash" 20 seconds ago Up 19 seconds desperate_meitner# docker exec -it desperate_meitner cat /etc/redhat-release CentOS release 6.8 (Final) You can see that the current image image is the version created at that time # docker exec -it desperate_meitner ip a1: lo: mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever311: eth0: mtu 1500 qdisc noqueue state UP link/ether 02:42:0a:00:00:25 brd ff:ff:ff:ff:ff:ff inet 10.0.0.37/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::42:aff:fe00:25/64 scope link valid_lft forever preferred_lft forever"docker images how to create" content introduced here, thank you for reading If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.