CN106790658A - A kind of Docker network plug-ins implementation method - Google Patents

A kind of Docker network plug-ins implementation method Download PDF

Info

Publication number
CN106790658A
CN106790658A CN201710039356.XA CN201710039356A CN106790658A CN 106790658 A CN106790658 A CN 106790658A CN 201710039356 A CN201710039356 A CN 201710039356A CN 106790658 A CN106790658 A CN 106790658A
Authority
CN
China
Prior art keywords
network
docker
container
host
plug
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
Application number
CN201710039356.XA
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information 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 Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201710039356.XA priority Critical patent/CN106790658A/en
Publication of CN106790658A publication Critical patent/CN106790658A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • 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/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention provides a kind of Docker network plug-ins implementation method, belong to computer software application field, when business scenario needs to configure host network IP for Docker containers, when container is created, can be by specifying network plug-in title, call the network plug-in, now the network plug-in can create a pair of link in host network interface card, for connecting host network and capacitor network, the link that capacitor network is represented adds the NameSpace that container is provided, it is simultaneously the link configuration of IP and gateway, so that the IP of container and host IP are in the same network segment.

Description

A kind of Docker network plug-ins implementation method
Technical field
The present invention relates to computer software application technology, more particularly to a kind of Docker network plug-ins implementation method.
Background technology
Docker is an application container engine increased income, allow developer can pack they application and rely on bag arrive In one transplantable container, then it is published on the Linux machines of any prevalence, it is also possible to realize virtualization.Docker mesh Before there is multiple network pattern, comprising Bridge patterns, Host patterns, OverLay patterns, but these network modes but work as We want to allow Docker containers with host network in same address field, also without this Plugin Mechanism.Early stage is when our industry When business system needs this network mode, it is common practice that increase service code in operation layer and complete, now in the presence of many defects, For example when we use the ecological others open source projects of Docker(Compose)When carrying out container layout, it is impossible to call operation layer The IP management logics of realization.
Etcd is a key/value storage service applied under distributed environment, can in the cluster share letter Breath, reads writing speed quickly.When we under cluster environment, it is necessary to during using the network plug-in, it is possible to use Etcd is used for The storage network information, the network plug-in of different nodes can share the network information of Etcd storages.
Docker is ecological to provide ripe network plug-in mechanism, and user can be based on the ecological networks for providing of Docker API, the self-defined business network of oneself completes the distribution and recovery of Docker capacitor networks.
The content of the invention
The present invention proposes a kind of Docker network plug-ins implementation method.Solve in production environment with Docker network egress The form of part completes the IP management of container such that it is able to preferably carried using the Container Management and Docker ecologies of Docker The sundry item of confession.
The technical scheme is that:
When business scenario needs to configure host network IP for Docker containers, first when container is created, can be by referring to Determine network plug-in title, call the network plug-in, now the network plug-in can create a pair of link in host network interface card, for even Host network and capacitor network are connect, the link that capacitor network is represented adds the NameSpace that container is provided, while to be somebody's turn to do Link configuration of IP and gateway, so that the IP of container and host IP are in the same network segment, and are maintained in the life cycle of container Keep constant.
Comprise the following steps that:
A:Host creates br0 bridges, and will change bridge and be tied to eth0, installs the Docker of 1.12 versions
B:Host operational network plug-in unit, network is created using docker orders, and it is locak to specify network driver, and is specified Network Details:
docker network create --driver=local --gateway=192.168.159.2 --subnet= 192.168.159.0/24 local
C:Container is created based on docker orders
docker run -itd --ip=192.168.159.140 --net=local 10.110.17.138:5000/ centos:6.7
D:Container is created successfully, logs in container, can view container IP information.
This method is realized based on golang language, when needs are made when cluster environment is using the plug-in unit, it is necessary to install Etcd It is shared storage, for storing the network information, while needing to start plug-in unit in each host.
When network is created, first check for whether the network has created completion, if not creating, network trust system is arrived Etcd databases.
The beneficial effects of the invention are as follows
The Docker ecosystems provide a kind of network plug-in mechanism, it is allowed to the network insertion that user oneself will define to Docker The ecosystem, network plug-in mechanism of the present invention based on Docker, Docker containers are realized with reference to Linux iptables technologies IP distribution and configure, when the IP address of Docker containers is needed with the network of host, it is possible to use the plug-in unit complete from Dynamicization is configured, and reduces a large number of services layer logic, and can be consistent with Docker ecologies.
Brief description of the drawings
Fig. 1 is cluster mode lower network plug-in unit deployment schematic diagram;
Fig. 2 is capacitor network and Link to schematic diagram.
Specific embodiment
More detailed elaboration is carried out to present disclosure below:
1) this method environment is based on Ubuntu14.04 operating systems, and host needs to create network br0, and is tied to eth0, Host disposes the Docker of 1.12 versions, and the listening port of Docker is br0, as follows:DOCKER_OPTS="$ DOCKER_OPTS -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --cluster- store=etcd://127.0.0.1:4001 --cluster-advertise=br0:2376"
2) this method based on golang language realize, when need when cluster environment is using the plug-in unit, it is necessary to install Etcd as Shared storage, for storing the network information, while need to start plug-in unit in each host, as shown in Figure 1.
3) this method first checks for whether the network has created completion, if not creating, by network when network is created Information is saved in Etcd databases.
4)When creating container based on this method, network plug-in can obtain the IP that can be used from Etcd databases, and to hold Device creates a pair of link, and configuration of IP, as shown in Figure 2.

Claims (4)

1. a kind of Docker network plug-ins implementation method, it is characterised in that
When business scenario needs to configure host network IP for Docker containers, first when container is created by specifying network egress Part title, calls the network plug-in, and now the network plug-in can create a pair of link in host network interface card, for connecting host Network and capacitor network, the link that capacitor network is represented add the NameSpace that container is provided, while being the link configuration of IP And gateway, so that the IP of container and host IP are in the same network segment, and it is constant to be maintained at holding in the life cycle of container.
2. method according to claim 1, it is characterised in that
Comprise the following steps that:
A:Host creates br0 bridges, and will change bridge and be tied to eth0, installs the Docker of 1.12 versions
B:Host operational network plug-in unit, network is created using docker orders, and it is locak to specify network driver, and is specified Network Details:
docker network create --driver=local --gateway=192.168.159.2 --subnet= 192.168.159.0/24 local
C:Container is created based on docker orders
docker run -itd --ip=192.168.159.140 --net=local 10.110.17.138:5000/ centos:6.7
D:Container is created successfully, logs in container, can view container IP information.
3. method according to claim 2, it is characterised in that
This method based on golang language realize, when need when cluster environment is using the plug-in unit, it is necessary to install Etcd as altogether Storage is enjoyed, for storing the network information, while needing to start plug-in unit in each host.
4. method according to claim 2, it is characterised in that
When network is created, first check for whether the network has created completion, if not creating, by network trust system to Etcd Database.
CN201710039356.XA 2017-01-19 2017-01-19 A kind of Docker network plug-ins implementation method Pending CN106790658A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710039356.XA CN106790658A (en) 2017-01-19 2017-01-19 A kind of Docker network plug-ins implementation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710039356.XA CN106790658A (en) 2017-01-19 2017-01-19 A kind of Docker network plug-ins implementation method

Publications (1)

Publication Number Publication Date
CN106790658A true CN106790658A (en) 2017-05-31

Family

ID=58944252

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710039356.XA Pending CN106790658A (en) 2017-01-19 2017-01-19 A kind of Docker network plug-ins implementation method

Country Status (1)

Country Link
CN (1) CN106790658A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109462511A (en) * 2018-12-11 2019-03-12 中科曙光国际信息产业有限公司 The method for building up and device of network
CN110995561A (en) * 2019-12-06 2020-04-10 中国科学院信息工程研究所 Virtual network data communication interaction method and system based on container technology
CN111399927A (en) * 2018-12-14 2020-07-10 北京奇虎科技有限公司 Method and device for sharing Class file by application and computing equipment
CN111884919A (en) * 2020-07-02 2020-11-03 苏州浪潮智能科技有限公司 Method, device, equipment and readable medium for clearing invalid virtual IP
CN113766042A (en) * 2021-01-20 2021-12-07 北京沃东天骏信息技术有限公司 Container address configuration method, system, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105491123A (en) * 2015-12-04 2016-04-13 北京航空航天大学 Communication method and device among containers
CN105812222A (en) * 2016-03-10 2016-07-27 汉柏科技有限公司 Multi-tenant virtual network and realization method based on virtual machine and container
CN105897946A (en) * 2016-04-08 2016-08-24 北京搜狐新媒体信息技术有限公司 Obtaining method and system of access address
CN105978781A (en) * 2016-06-28 2016-09-28 浪潮电子信息产业股份有限公司 Method and system for establishing network connection of Docker container, and client side
CN106161104A (en) * 2016-08-22 2016-11-23 浪潮电子信息产业股份有限公司 Method for automatically configuring network IP (Internet protocol) of Docker container and host based on Docker event

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105491123A (en) * 2015-12-04 2016-04-13 北京航空航天大学 Communication method and device among containers
CN105812222A (en) * 2016-03-10 2016-07-27 汉柏科技有限公司 Multi-tenant virtual network and realization method based on virtual machine and container
CN105897946A (en) * 2016-04-08 2016-08-24 北京搜狐新媒体信息技术有限公司 Obtaining method and system of access address
CN105978781A (en) * 2016-06-28 2016-09-28 浪潮电子信息产业股份有限公司 Method and system for establishing network connection of Docker container, and client side
CN106161104A (en) * 2016-08-22 2016-11-23 浪潮电子信息产业股份有限公司 Method for automatically configuring network IP (Internet protocol) of Docker container and host based on Docker event

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109462511A (en) * 2018-12-11 2019-03-12 中科曙光国际信息产业有限公司 The method for building up and device of network
CN111399927A (en) * 2018-12-14 2020-07-10 北京奇虎科技有限公司 Method and device for sharing Class file by application and computing equipment
CN110995561A (en) * 2019-12-06 2020-04-10 中国科学院信息工程研究所 Virtual network data communication interaction method and system based on container technology
CN111884919A (en) * 2020-07-02 2020-11-03 苏州浪潮智能科技有限公司 Method, device, equipment and readable medium for clearing invalid virtual IP
CN111884919B (en) * 2020-07-02 2022-12-02 苏州浪潮智能科技有限公司 Method, device, equipment and readable medium for clearing invalid virtual IP
CN113766042A (en) * 2021-01-20 2021-12-07 北京沃东天骏信息技术有限公司 Container address configuration method, system, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN106790658A (en) A kind of Docker network plug-ins implementation method
CN107637042B (en) Custom communication channel for application deployment
CN105224466B (en) A kind of integration test method and system based on Docker
US20190171435A1 (en) Distributed upgrade in virtualized computing environments
CN107846465A (en) Update the method and apparatus of client resource bag
CN105893008A (en) Method and device for customizing multi-channel installation package
CN107925677A (en) For unloading the technology of data object replication and service function chain management
WO2013192361A1 (en) Establishing an initial configuration of a hardware inventory
CN106227605A (en) The dynamic micro services expansion method of a kind of multilingual cloud compiling and device
CN106445951A (en) File transmission method and apparatus
CN108259200B (en) A kind of physical network function PNF moving method and relevant device
CN106339177A (en) Method and device for creating virtual machines
CN107783816A (en) The method and device that creation method and device, the big data cluster of virtual machine create
CN112631614B (en) Application deployment method, device, computer equipment and storage medium
CN113938321B (en) Extensible operation and maintenance management system, method, electronic equipment and readable storage medium
CN107317832A (en) Message forwarding method and device
CN104281484A (en) VM (virtual machine) migration method and device
CN111264048A (en) Method of defining a Network Service Descriptor (NSD) for a Network Service (NS) and Network Function Virtualization (NFV) orchestrator (NFVO) using the NSD
CN111405590B (en) Method, device and storage medium for exporting data traffic of virtualized network element
CN111371608B (en) Method, device and medium for deploying SFC service chain
CN104092661B (en) The communication means and device of virtual machine serial ports
CN110958138B (en) Container expansion method and device
CN113127023B (en) Service upgrading method, device and system
CN116601605A (en) Declaratively provisioning resources on a cloud platform
CN102571381B (en) A kind of information storage means and information-storing device

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20170531

RJ01 Rejection of invention patent application after publication