CN110781020A - Method, device and medium for detecting container based on docker - Google Patents

Method, device and medium for detecting container based on docker Download PDF

Info

Publication number
CN110781020A
CN110781020A CN201910912113.1A CN201910912113A CN110781020A CN 110781020 A CN110781020 A CN 110781020A CN 201910912113 A CN201910912113 A CN 201910912113A CN 110781020 A CN110781020 A CN 110781020A
Authority
CN
China
Prior art keywords
docker
container
configuration items
slices
normal
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.)
Withdrawn
Application number
CN201910912113.1A
Other languages
Chinese (zh)
Inventor
李永杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Wave Intelligent Technology Co Ltd
Original Assignee
Suzhou Wave Intelligent Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Suzhou Wave Intelligent Technology Co Ltd filed Critical Suzhou Wave Intelligent Technology Co Ltd
Priority to CN201910912113.1A priority Critical patent/CN110781020A/en
Publication of CN110781020A publication Critical patent/CN110781020A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0712Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a virtual computing platform, e.g. logically partitioned systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a container detection method based on docker, which comprises the following steps: selecting a container to be detected; slicing the docker based on the configuration items of the container; respectively judging whether the slices are normal; and restarting the docker in response to the exception existing in the slice. The invention also discloses a computer device and a readable storage medium. The method, the device and the medium for detecting the container based on the docker provided by the invention can realize deeper detection by slicing the docker memory block, thereby easily detecting the abnormality in the program and improving the performance of the system.

Description

Method, device and medium for detecting container based on docker
Technical Field
The present invention relates to the field of detection, and more particularly, to a method, an apparatus, and a readable medium for detecting a container based on a docker.
Background
The Docker is an open-source application container engine, and can integrate a plurality of application programs into one Docker and publish the plurality of application programs to the terminal device through the Docker. At present, a multi-device management system adopts a docker containerization technology in development, test and production environments, at present, health inspection on a docker container is only limited to a container level, but if the container runs normally, but a program in the container is abnormal, the outside cannot be detected normally.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, and a medium for detecting a container based on a docker, which can implement deeper detection by slicing a docker memory block, thereby easily detecting an exception in a program and improving system performance.
In view of the above, an aspect of the embodiments of the present invention provides a method for detecting a container based on docker, including the following steps: selecting a container to be detected; slicing the docker based on the configuration items of the container; respectively judging whether the slices are normal; and restarting the docker in response to the exception being present in the slice.
In some embodiments, the slicing the docker based on the configuration item of the container comprises: and dividing the memory blocks of the docker into different slices based on the types of the configuration items of the container.
In some embodiments, the separately determining whether the slices are normal comprises: and calling an application programming interface to detect whether the configuration items in the slice are normal.
In some embodiments, further comprising: and responding to the container stop or abnormal configuration items, displaying abnormal states and giving an alarm.
In some embodiments, the configuration items include: ports, processes, and logs.
In another aspect of the embodiments of the present invention, there is also provided a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: selecting a container to be detected; slicing the docker based on the configuration items of the container; respectively judging whether the slices are normal; and restarting the docker in response to the exception being present in the slice.
In some embodiments, the slicing the docker based on the configuration item of the container comprises: and dividing the memory blocks of the docker into different slices based on the types of the configuration items of the container.
In some embodiments, the separately determining whether the slices are normal comprises: and calling an application programming interface to detect whether the configuration items in the slice are normal.
In some embodiments, the steps further comprise: and responding to the container stop or abnormal configuration items, displaying abnormal states and giving an alarm.
In a further aspect of the embodiments of the present invention, a computer-readable storage medium is also provided, in which a computer program for implementing the above method steps is stored when the computer program is executed by a processor.
The invention has the following beneficial technical effects: by slicing the docker memory block, deeper detection can be realized, so that the abnormality in the program can be easily detected, and the performance of the system is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
FIG. 1 is a schematic diagram of an embodiment of a docker-based method of inspecting containers according to the present invention;
fig. 2 is a flowchart of an embodiment of a method for detecting a container based on docker provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
In view of the above objects, a first aspect of embodiments of the present invention proposes an embodiment of a method for detecting containers based on docker. Fig. 1 is a schematic diagram illustrating an embodiment of a method for detecting containers based on docker provided by the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
s1, selecting a container to be detected;
s2, slicing the docker based on the configuration items of the container;
s3, respectively judging whether the slices are normal; and
s4, in response to the exception existing in the slice, restarting the docker.
Common containers include tomcat, mysql, and the like. The configuration items of different containers are generally the same, and there may be slight differences. In some embodiments, the configuration items include: ports, processes, and logs. Of course, this is not a limitation on the configuration items, and in other embodiments, other configuration items may exist.
And slicing the docker based on the configuration items of the container. In some embodiments, the slicing the docker based on the configuration item of the container comprises: and dividing the memory blocks of the docker into different slices based on the types of the configuration items of the container. And the memory blocks can be segmented based on configuration items of common containers in the multi-device management system, and the segmented blocks are docker slices. That is, based on the docker container technology, health examination is performed from the docker application layer, and a container to be detected is configured in docker slicing.
And respectively judging whether the slices are normal. Whether slices are normal or not can be detected one by one in sequence, priorities can also be set according to the importance degrees of configuration items, and whether slices are normal or not can be detected in sequence from high to low in priority, but the detection order is not limited, and in other embodiments, other detection modes can also be adopted, for example, a random spot check mode can be adopted. In some embodiments, the separately determining whether the slices are normal comprises: and calling an application programming interface to detect whether the configuration items in the slice are normal. An API (Application programming interface) is a predefined function that is intended to provide applications and developers the ability to access a set of routines based on certain software or hardware, without accessing source code or understanding the details of the internal workings. Therefore, whether the program of the configuration item is abnormal or not can be conveniently and quickly detected by adopting the API.
In some embodiments, the program in the container can be detected in a user-defined mode, so that the running state of the program can be detected finely, the problem location can be facilitated, the problem troubleshooting cost is reduced, the problem program can be found in time and the damage can be stopped in time, and the loss caused by program abnormity is greatly reduced.
In some embodiments, further comprising: and responding to the container stop or abnormal configuration items, displaying abnormal states and giving an alarm. In order to facilitate the maintenance personnel to know the abnormal condition in time, the abnormal condition can be displayed on the display device and simultaneously an alarm can be given, such as the flashing of an indicator lamp or the sounding of a buzzer.
Restarting the docker in response to the slice exception. Before restarting the docker, the specific condition of the abnormal state can be checked, and simple repair or direct docker restart can be performed according to the specific condition.
Fig. 2 is a flowchart illustrating an embodiment of a method for detecting containers based on docker provided in the present invention. As shown in fig. 2, starting at block 101 and proceeding to block 102, a container to be tested is selected; proceeding to block 103, slicing the docker based on the configuration items of the container; then proceed to block 104, select slices in turn; then, the process proceeds to block 105, whether the slices are normal or not is judged, if the slices are normal, the process proceeds to block 107, and the process ends, if the slices are abnormal, the process proceeds to block 106, the docker is restarted, the process returns to block 104, and whether the slices are normal or not is selected again and judged.
It should be particularly noted that, the steps in the embodiments of the method for detecting containers based on docker can be mutually intersected, replaced, added, or deleted, and therefore, the method for detecting containers based on docker with these reasonable permutations and combinations should also belong to the scope of the present invention, and should not limit the scope of the present invention to the embodiments.
In view of the above object, a second aspect of the embodiments of the present invention provides a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: s1, selecting a container to be detected; s2, slicing the docker based on the configuration items of the container; s3, respectively judging whether the slices are normal; and S4, restarting the docker in response to the exception existing in the slice.
In some embodiments, the slicing the docker based on the configuration item of the container comprises: and dividing the memory blocks of the docker into different slices based on the types of the configuration items of the container.
In some embodiments, the separately determining whether the slices are normal comprises: and calling an application programming interface to detect whether the configuration items in the slice are normal.
In some embodiments, the steps further comprise: and the container stops or the configuration item is abnormal, and the abnormal state is displayed and alarmed.
In some embodiments, the configuration items include: ports, processes, and logs.
The invention also provides a computer readable storage medium storing a computer program which, when executed by a processor, performs the method as above.
Finally, it should be noted that, as one of ordinary skill in the art can appreciate that all or part of the processes of the methods of the above embodiments can be implemented by a computer program to instruct related hardware, and the program of the method for detecting a container based on docker can be stored in a computer readable storage medium, and when executed, the program can include the processes of the embodiments of the methods described above. The storage medium of the program may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a Random Access Memory (RAM), or the like. The embodiments of the computer program may achieve the same or similar effects as any of the above-described method embodiments.
Furthermore, the methods disclosed according to embodiments of the present invention may also be implemented as a computer program executed by a processor, which may be stored in a computer-readable storage medium. Which when executed by a processor performs the above-described functions defined in the methods disclosed in embodiments of the invention.
Further, the above method steps and system elements may also be implemented using a controller and a computer readable storage medium for storing a computer program for causing the controller to implement the functions of the above steps or elements.
Further, it should be appreciated that the computer-readable storage media (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein may be implemented or performed with the following components designed to perform the functions herein: a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary designs, the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, Digital Versatile Disc (DVD), floppy disk, blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.

Claims (10)

1. A method for detecting a container based on docker is characterized by comprising the following steps:
selecting a container to be detected;
slicing the docker based on the configuration items of the container;
respectively judging whether the slices are normal; and
restarting the docker in response to the presence of the exception in the slice.
2. The method of claim 1, wherein slicing docker based on the configuration items of the container comprises:
and dividing the memory blocks of the docker into different slices based on the types of the configuration items of the container.
3. The method of claim 2, wherein the separately determining whether the slices are normal comprises:
and calling an application programming interface to detect whether the configuration items in the slice are normal.
4. The method of claim 3 further comprising:
and responding to the container stop or abnormal configuration items, displaying abnormal states and giving an alarm.
5. The method of claim 1, wherein the configuration item comprises: ports, processes, and logs.
6. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of:
selecting a container to be detected;
slicing the docker based on the configuration items of the container;
respectively judging whether the slices are normal; and
restarting the docker in response to the presence of the exception in the slice.
7. The computer device of claim 6, wherein the slicing the docker based on the configuration items of the container comprises:
and dividing the memory blocks of the docker into different slices based on the types of the configuration items of the container.
8. The computer device of claim 7, wherein the separately determining whether the slices are normal comprises:
and calling an application programming interface to detect whether the configuration items in the slice are normal.
9. The computer device of claim 8, wherein the steps further comprise:
and responding to the container stop or abnormal configuration items, displaying abnormal states and giving an alarm.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN201910912113.1A 2019-09-25 2019-09-25 Method, device and medium for detecting container based on docker Withdrawn CN110781020A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910912113.1A CN110781020A (en) 2019-09-25 2019-09-25 Method, device and medium for detecting container based on docker

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910912113.1A CN110781020A (en) 2019-09-25 2019-09-25 Method, device and medium for detecting container based on docker

Publications (1)

Publication Number Publication Date
CN110781020A true CN110781020A (en) 2020-02-11

Family

ID=69384515

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910912113.1A Withdrawn CN110781020A (en) 2019-09-25 2019-09-25 Method, device and medium for detecting container based on docker

Country Status (1)

Country Link
CN (1) CN110781020A (en)

Similar Documents

Publication Publication Date Title
CN107657177B (en) Vulnerability detection method and device
US11321081B2 (en) Affinity recommendation in software lifecycle management
CN110992992A (en) Hard disk test method, device and storage medium
US11017875B2 (en) Tracking address ranges for computer memory errors
US20160188449A1 (en) Software aging test system, software aging test method, and program for software aging test
US20130311833A1 (en) Computing device and method for testing components of the computing device
US20200193021A1 (en) Malware collusion detection
CN111367807B (en) Log analysis method, system, device and medium
US10331540B2 (en) Identifying false positive automated tests
CN111352784B (en) Production test method, device, equipment and readable medium
CN113806155B (en) Industrial equipment management method and system based on Internet of things
CN110781020A (en) Method, device and medium for detecting container based on docker
CN111209606A (en) Method, device and equipment for early warning of hard disk change behind RAID card
JP2014021577A (en) Apparatus, system, method, and program for failure prediction
CN112887123A (en) Service alarm method, system and device based on call chain
CN114281611A (en) Method, system, equipment and storage medium for comprehensively detecting system disk
CN111611135B (en) CPLD or FPGA signal processing method, device, equipment and readable medium
CN111427756B (en) Method, system, equipment and medium for carrying out mixed pressure test on single hard disk
US10241892B2 (en) Issuance of static analysis complaints
CN112241343A (en) Slow disk detection method and device, electronic equipment and readable storage medium
US20180220206A1 (en) Interpretation of supplemental sensors
US11853189B2 (en) Apparatus and method for providing error information using graphical user interface
CN111258301B (en) Problem detection method and device
CN115223643A (en) Method, device and equipment for monitoring flash memory state and readable medium
CN111241560B (en) Device detection control method and system, computer device, and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20200211

WW01 Invention patent application withdrawn after publication