CN108170514A - A kind of container operation method and device - Google Patents
A kind of container operation method and device Download PDFInfo
- Publication number
- CN108170514A CN108170514A CN201711480572.4A CN201711480572A CN108170514A CN 108170514 A CN108170514 A CN 108170514A CN 201711480572 A CN201711480572 A CN 201711480572A CN 108170514 A CN108170514 A CN 108170514A
- Authority
- CN
- China
- Prior art keywords
- container
- btrfs
- embedded device
- mirror image
- disk spaces
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of container operation method and devices, are related to field of computer technology, and method is applied to embedded device, and method includes:BTRFS disk spaces are divided on the embedded device, container on the BTRFS disk spaces is installed, and the storage driving of the container is set as BTRFS, according to preset consolidation strategy, the mirror image of the container is merged into an Image Planes.The read-write efficiency of the file of embedded device can be improved using the present invention.
Description
Technical field
The present invention relates to field of computer technology, more particularly to a kind of container operation method and device.
Background technology
Container technique is a kind of virtualization technology of kernel level, can provide the virtualization of lightweight, realize process and
The isolation of resource.Meanwhile container technique does not need to provide instruction explanation facility and other fully virtualized complexity.For example,
Docker container techniques have very strong portability, can be wrapped in application program in container and be published to operation Linux behaviour
Make to carry out operation use in the equipment of system.Therefore, container technique rapid proliferation is promoted, and is advised greatly in internal production environment
Mould uses.
BTRFS file system is referred to as next-generation copy-on-write file system, has been incorporated into the interior of (SuSE) Linux OS
Core belongs to file-level storage.BTRFS file system uses the transaction management of copy-on-write (Copy-On-Write, COW), can be with
Ensure consistency of the data when failure powers off.The foundation image of the container of BTRFS file system is the snapshot of subfile system,
Every sub- mirror image and container have the snapshot of oneself, and using COW technologies it is only necessary to change corresponding piece, it is not necessary to modify entire texts
Part can improve the rate that file is write.
In existing extra large service system, Hai Duan is flooded with a large amount of embedded device, builds efficient container running environment
It is of great significance to the resource utilization for improving extra large service system, and the file system that container running environment is relied on is then it
In an important ring.The file system that existing container operation uses is (for example, AUFS file system, BTFS file system, VFS texts
Part system etc.) it is to be designed for server characteristics, occupancy system space is big, and efficiency is low.However, embedded set
The standby performances such as limited storage space, CPU are low, and based on existing file system, the read-write efficiency of file is low.
Invention content
In order to solve problem of the prior art, an embodiment of the present invention provides a kind of container operation method and devices.It is described
Technical solution is as follows:
In a first aspect, providing a kind of container operation method, the method is applied to embedded device, the method packet
It includes:
BTRFS disk spaces are divided on the embedded device;
Container on the BTRFS disk spaces is installed, and the storage driving of the container is set as BTRFS;
According to preset consolidation strategy, the mirror image of the container is merged into an Image Planes.
Optionally, it is described that BTRFS disk spaces are divided on the embedded device, including:
The installation operation system on the embedded device;
BTRFS disk spaces are divided in the operating system, and the BTRFS disk spaces are set as BTRFS texts
Part system.
Optionally, it is described according to preset consolidation strategy, the mirror image of the container is merged into an Image Planes, and create
Snapshot, including:
According to preset consolidation strategy, the readable layer of each mirror image of the container is merged into an Image Planes, will be read and write
Layer merges into a container floor;
The priority of container catalogue is set to be more than mirror image catalogue, so that when the embedded device reads file, is first read
Take the content of the container catalogue.
Optionally, the preset consolidation strategy is Overlay file drivings.
Second aspect, provides a kind of container running gear, and described device is applied to embedded device, described device packet
It includes:
Division module, for dividing BTRFS disk spaces on the embedded device;
Setup module for installing container on the BTRFS disk spaces, and the storage driving of the container is set
For BTRFS;
Merging module, for according to preset consolidation strategy, the mirror image of the container to be merged into an Image Planes, and create
Build snapshot.
Optionally, the division module, is specifically used for:
The installation operation system on the embedded device;
BTRFS disk spaces are divided in the operating system, and the BTRFS disk spaces are set as BTRFS texts
Part system.
Optionally, the merging module, is specifically used for:
According to preset consolidation strategy, the readable layer of each mirror image of the container is merged into an Image Planes, will be read and write
Layer merges into a container floor;
The priority of container catalogue is set to be more than mirror image catalogue, so that when the embedded device reads file, is first read
Take the content of the container catalogue.
Optionally, the preset consolidation strategy is Overlay file drivings.
The present invention provides a kind of container operation method, BTRFS disk spaces is divided on embedded device, in BTRFS magnetic
Container on disk space is installed, and the storage driving of container is set as BTRFS, according to preset consolidation strategy, by the mirror of container
As being merged into an Image Planes, and create snapshot.The read-write efficiency of the file of embedded device can be improved.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is only some embodiments of the present invention, for
For those of ordinary skill in the art, without creative efforts, other are can also be obtained according to these attached drawings
Attached drawing.
Fig. 1 is a kind of method flow diagram of container operation method provided in an embodiment of the present invention;
Fig. 2 is a kind of structure diagram of container running gear provided in an embodiment of the present invention.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention
Formula is described in further detail.
As shown in Figure 1, by installing container on the BTRFS disk spaces of embedded device, according to consolidation strategy to this
The mirror image of container is merged into an Image Planes, can improve the read-write efficiency of the file of embedded device, be as follows:
Step 101, BTRFS disk spaces are divided on embedded device.Concrete processing procedure is as follows:
Step 1: the installation operation system on embedded device
In force, embedded device receives the download instruction that user issues, and according to the download instruction down operation system
System, wherein, operating system can select the operating system of lightweight.Wherein, the version of operating system can select
hypriotos-rpi-v1.1.3。
Embedded device can receive the installation instruction that user issues, according to the installation instruction after down operation system
Mirror-write USB flash disk tool is written into operating system, the operating system in the mirror-write USB flash disk tool is then written to embedded device
SD card in.The mirror-write USB flash disk tool can select Win32DiskImager.
In addition, embedded device after installation operation system, can receive the configuration-direct that user issues, according to the configuration
Instruction starts and configuration embedded device.Wherein, configuration-direct includes:Username and password input instruction, Network card setup and again
Open instruction, remote access instruction of restarting, DNS (Domain Name System, domain name system) configuration-direct etc..
It should be noted that the data packet of operating system can be imported into SD card by user in advance, embedded device can be with
The decompressed instruction issued by remote access reception user can perform tar orders decompression and install the operating system.
Step 2 divides BTRFS disk spaces in the operating system, and the BTRFS disk spaces is set as
BTRFS file system.
In force, embedded device receives the cancellation equipment mounting instructions that user issues, according to the cancellation equipment carry
Instruction performs umount/dev/sdX orders, to cancel equipment carry, wherein ,/dev/sdX is the mark of embedded device.
It is then inserted into formula equipment and receives the partitioning instruction that user issues, fdisk/dev/sdX orders are performed according to the partitioning instruction, so as to
BTRFS disk spaces are divided to equipment.Wherein, embedded device is dividing BTRFS disk spaces by performing fdisk orders
When, subregion is increased newly by n orders first, p command selections main partition is then performed, subsequently performs 3 command selection third subregions,
W orders are finally performed to be preserved.
Embedded device receives the BTRFS installation instructions that user issues, and embedded device is held according to the BTRFS installation instructions
Row apt-get install btrfs-tools Installing of Command btrfs tools.It is then inserted into formula equipment and performs mkfs.btrfs/
Zoned format is turned to btrfs file system by dev/sdX orders.Subsequently, embedded device performs mkdir mybtrfs orders
New folder, wherein, mybtrfs is local file title.Finally, embedded device performs mount/dev/
The subregion is mounted to mybtrfs by sdX3mybtrfs orders.
It should be noted that for the ease of detection, user can send multi-section display instruction to embedded device, embedded
Equipment receives the multi-section display instruction that user issues, and is instructed according to the multi-section display and performs fdisk-l orders, with display point
Area.
Step 102, container on BTRFS disk spaces is installed, and the storage driving of container is set as BTRFS.
In force, embedded device can receive the container installation instruction that user issues, according to the container installation instruction
Dockerd--storage-driver btrfs--graph/home/pirate/mybtrfs/& orders are performed, to start storage
It is driven to defender's process of BTRFS file system.Then, embedded device performs docker pull
Container4armhf/armhf-alpine Installing of Command container mirror images.Finally, embedded device can perform docker
run-it–v/home/pirate/mybtrfs/iozone/iozone3_434/src/current:/mywork armv7/
Armhf-ubuntu/bin/sh orders run container.
It should be noted that user can send container idsplay order to embedded device, embedded device receives this
Container idsplay order performs docker info orders according to the container idsplay order and checks information of container.
Meanwhile after container is installed, user can test the file system of embedded device, and user can be to
Embedded device issues test instruction, after embedded device receives the test instruction that user issues, can download and install survey
Trial work has, and performs ./iozone-a-s 512m-i 0-i 1-f/mybtrfs/testfile-Rb output.xls orders to text
Part system is tested.Wherein, testing tool can select iozone file tools, and embedded device can pacify testing tool
It is attached in operating system or in container.
Step 103, according to preset consolidation strategy, the mirror image of the container is merged into an Image Planes.
In force, the structure chart of the container mirror image based on primary BTRFS.The one of important feature of container running environment
It is exactly layering, Docker is managed for convenience and mirror image is directly fully shared, and multilayer can be all used when building mirror image
Mechanism, a line command just corresponds to one layer in Dockerfile, and a common container can be all made of tens layers mirror image.It is existing
In Docker technologies, last layer image dependency is in the snapshot of bottom mirror image, when container needs to operate the file of the bottom
When, across multilayer lookup is needed, the more file read-write efficiency on bottom mirror image is lower, has seriously affected the operational efficiency of container.
And the following characteristic in BTRFS file system:The container mirror image that son volume subvolume and snapshot snapshot is formed
Administrative mechanism, since all subfile systems share the device space of bottom, so it is higher for bottom disk space usage.
Specific implementation step is as follows:
The readable layer of each mirror image of the container according to preset consolidation strategy, is merged into an Image Planes by step 1,
Writable layer is merged into a container floor.Wherein, preset consolidation strategy is Overlay file drivings.
In force, using existing Overlay file drivings, readable layer is merged into an Image Planes, will be read and write
Layer becomes container floor, wherein, the file of container floor is dominant, can hide the identical file of Image Planes.And container is finally by institute
There is file to show.Here, the mirror image that container relies on is merged into an Image Planes by us
Step 2, the priority of setting container catalogue are more than mirror image catalogue, so that when the embedded device reads file
When, first read the content of the container catalogue.
In force, when reading file, the content of container catalogue is first read, ensures container catalogue prior to mirror image mesh
Record.Based on the mechanism, no matter file is in mirror image random layer, read-write efficiency all almost quite, without increasing with the number of plies
Read-write efficiency reduces.
The present invention provides a kind of container operation method, BTRFS disk spaces is divided on embedded device, in BTRFS magnetic
Container on disk space is installed, and the storage driving of container is set as BTRFS, according to preset consolidation strategy, by the mirror of container
As being merged into an Image Planes, and create snapshot.The read-write efficiency of the file of embedded device can be improved.
Based on identical technical concept, as shown in Fig. 2, the embodiment of the present application additionally provides a kind of embedded container fortune
Capable device, described device are applied to embedded device, and described device includes:
Division module 210, for dividing BTRFS disk spaces on the embedded device;
Setup module 220, for installing container on the BTRFS disk spaces, and by the storage driving of the container
It is set as BTRFS;
Merging module 230, for according to preset consolidation strategy, the mirror image of the container to be merged into an Image Planes,
And create snapshot.
Optionally, the division module 210, is specifically used for:
The installation operation system on the embedded device;
BTRFS disk spaces are divided in the operating system, and the BTRFS disk spaces are set as BTRFS texts
Part system.
Optionally, the merging module 230, is specifically used for:
According to preset consolidation strategy, the readable layer of each mirror image of the container is merged into an Image Planes, will be read and write
Layer merges into a container floor;
The priority of container catalogue is set to be more than mirror image catalogue, so that when the embedded device reads file, is first read
Take the content of the container catalogue.
Optionally, the preset consolidation strategy is Overlay file drivings.
The present invention provides a kind of container operation method, and BTRFS disks are divided on embedded device by division module 210
Then container is installed, and the storage driving of container is set as in space by setup module 220 on BTRFS disk spaces
The mirror image of container finally by merging module 230 according to preset consolidation strategy, is merged into an Image Planes, and create by BTRFS
Build snapshot.The read-write efficiency of the file of embedded device can be improved.
Each embodiment in this specification is described using relevant mode, identical similar portion between each embodiment
Point just to refer each other, and the highlights of each of the examples are difference from other examples.Especially for device reality
For applying example, since it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
The foregoing is merely the preferred embodiments of the application, are not intended to limit the protection domain of the application.It is all
Any modification, equivalent replacement, improvement and so within spirit herein and principle are all contained in the protection domain of the application
It is interior.
Claims (8)
1. a kind of container operation method, which is characterized in that the method is applied to embedded device, the method includes:
BTRFS disk spaces are divided on the embedded device;
Container on the BTRFS disk spaces is installed, and the storage driving of the container is set as BTRFS;
According to preset consolidation strategy, the mirror image of the container is merged into an Image Planes.
2. according to the method described in claim 1, it is characterized in that, described divide BTRFS disks on the embedded device
Space, including:
The installation operation system on the embedded device;
BTRFS disk spaces are divided in the operating system, and the BTRFS disk spaces are set as BTRFS files system
System.
3. according to the method described in claim 1, it is characterized in that, described according to preset consolidation strategy, by the container
Mirror image is merged into an Image Planes, including:
According to preset consolidation strategy, the readable layer of each mirror image of the container is merged into an Image Planes, will be read and write laminated
And it is a container floor;
The priority of container catalogue is set to be more than mirror image catalogue, so that when the embedded device reads file, first reads institute
State the content of container catalogue.
4. according to the method described in claim 1, it is characterized in that, the preset consolidation strategy is Overlay file drivings.
5. a kind of container running gear, which is characterized in that described device is applied to embedded device, and described device includes:
Division module, for dividing BTRFS disk spaces on the embedded device;
Setup module for installing container on the BTRFS disk spaces, and the storage driving of the container is set as
BTRFS;
Merging module, for according to preset consolidation strategy, the mirror image of the container being merged into an Image Planes, and create fast
According to.
6. device according to claim 5, which is characterized in that the division module is specifically used for:
The installation operation system on the embedded device;
BTRFS disk spaces are divided in the operating system, and the BTRFS disk spaces are set as BTRFS files system
System.
7. device according to claim 5, which is characterized in that the merging module is specifically used for:
According to preset consolidation strategy, the readable layer of each mirror image of the container is merged into an Image Planes, will be read and write laminated
And it is a container floor;
The priority of container catalogue is set to be more than mirror image catalogue, so that when the embedded device reads file, first reads institute
State the content of container catalogue.
8. device according to claim 5, which is characterized in that the preset consolidation strategy is Overlay file drivings.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711377606 | 2017-12-19 | ||
CN2017113776067 | 2017-12-19 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108170514A true CN108170514A (en) | 2018-06-15 |
Family
ID=62516383
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711480572.4A Pending CN108170514A (en) | 2017-12-19 | 2017-12-29 | A kind of container operation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108170514A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109189418A (en) * | 2018-11-08 | 2019-01-11 | 郑州云海信息技术有限公司 | A kind of (SuSE) Linux OS Software Create, installation method and system |
CN109194725A (en) * | 2018-08-17 | 2019-01-11 | 杭州数梦工场科技有限公司 | A kind of transmission method of mirror image, device, equipment and computer storage medium |
CN112799740A (en) * | 2021-02-08 | 2021-05-14 | 联想(北京)有限公司 | Control method and device and electronic equipment |
CN113296887A (en) * | 2021-03-31 | 2021-08-24 | 阿里巴巴新加坡控股有限公司 | Method and device for starting safety container |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105607954A (en) * | 2015-12-21 | 2016-05-25 | 华南师范大学 | Stateful container online migration method and apparatus |
CN106227579A (en) * | 2016-07-12 | 2016-12-14 | 深圳市中润四方信息技术有限公司 | A kind of Docker container construction method and Docker manage control station |
CN106371878A (en) * | 2016-09-05 | 2017-02-01 | 北京海誉动想科技股份有限公司 | Device and method without installing and running applications in case system |
US20170180346A1 (en) * | 2015-12-18 | 2017-06-22 | Amazon Technologies, Inc. | Software container registry service |
-
2017
- 2017-12-29 CN CN201711480572.4A patent/CN108170514A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170180346A1 (en) * | 2015-12-18 | 2017-06-22 | Amazon Technologies, Inc. | Software container registry service |
CN105607954A (en) * | 2015-12-21 | 2016-05-25 | 华南师范大学 | Stateful container online migration method and apparatus |
CN106227579A (en) * | 2016-07-12 | 2016-12-14 | 深圳市中润四方信息技术有限公司 | A kind of Docker container construction method and Docker manage control station |
CN106371878A (en) * | 2016-09-05 | 2017-02-01 | 北京海誉动想科技股份有限公司 | Device and method without installing and running applications in case system |
Non-Patent Citations (1)
Title |
---|
王瑞雪: ""分布式业务集成部署平台的设计与实现"", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109194725A (en) * | 2018-08-17 | 2019-01-11 | 杭州数梦工场科技有限公司 | A kind of transmission method of mirror image, device, equipment and computer storage medium |
CN109189418A (en) * | 2018-11-08 | 2019-01-11 | 郑州云海信息技术有限公司 | A kind of (SuSE) Linux OS Software Create, installation method and system |
CN112799740A (en) * | 2021-02-08 | 2021-05-14 | 联想(北京)有限公司 | Control method and device and electronic equipment |
CN113296887A (en) * | 2021-03-31 | 2021-08-24 | 阿里巴巴新加坡控股有限公司 | Method and device for starting safety container |
CN113296887B (en) * | 2021-03-31 | 2023-12-08 | 阿里巴巴(中国)有限公司 | Method and device for starting safety container |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11593149B2 (en) | Unified resource management for containers and virtual machines | |
US10754829B2 (en) | Virtual configuration systems and methods | |
EP3686739B1 (en) | Method and system for enabling agentless backup and restore operations on a container orchestration platform | |
CN106537338B (en) | Self-expanding clouds | |
US8627310B2 (en) | Capturing multi-disk virtual machine images automatically | |
EP2372519B1 (en) | Storage optimization selection within a virtualization environment | |
US9069465B2 (en) | Computer system, management method of computer resource and program | |
EP2926253B1 (en) | Diagnostic virtual machine | |
US20160092119A1 (en) | Data migration between different types of storage systems | |
CN108170514A (en) | A kind of container operation method and device | |
US8683484B2 (en) | Intelligently pre-placing data for local consumption by workloads in a virtual computing environment | |
US20140007092A1 (en) | Automatic transfer of workload configuration | |
JP5352890B2 (en) | Computer system operation management method, computer system, and computer-readable medium storing program | |
US9268588B2 (en) | Optimizing virtual machine migration via identification and treatment of virtual memory swap file | |
US9395973B2 (en) | Virtual machine deployment method, recording medium, and information processing apparatus | |
CN105074665B (en) | Migration tool for realizing desktop virtualization | |
CN102754077A (en) | A secure virtualization environment bootable from an external media device | |
US10754699B2 (en) | Remote provisioning of virtual appliances for access to virtualized storage | |
CN105450759A (en) | System mirror image management method and device | |
US9699252B2 (en) | Deployment of virtual machine disks from a shared network file system | |
CN105704188A (en) | Deployment method and apparatus of applications and services | |
US20170139932A1 (en) | Allocating non-conflicting inode numbers | |
US20200326872A1 (en) | Data co-location in a hierarchical storage management (hsm) system | |
CN116028163A (en) | Method, device and storage medium for scheduling dynamic link library of container group | |
DE112021003803T5 (en) | POOL MANAGEMENT FOR APPLICATION LAUNCH IN AN ONBOARD UNIT |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180615 |
|
RJ01 | Rejection of invention patent application after publication |