Madhu Venugopal 50db985c1d Few more fixes identified during integration 9 rokov pred
..
Godeps 87f5a70f0a Godep update to libkv 1.9.0-integ branch 9 rokov pred
api bd45253fb5 move Labels from array to map to be consistent with cotnainers 9 rokov pred
bitseq af3eb25d44 Phase-2 bridge driver changes to support IPAM 9 rokov pred
client 2401496d2a Enable network labels in Rest API 9 rokov pred
cmd 2401496d2a Enable network labels in Rest API 9 rokov pred
config 4543607d74 Merge pull request #602 from dhiltgen/tls 9 rokov pred
datastore 268d41835d Make bridge driver networks persistent 9 rokov pred
docs e412743e45 Merge pull request #574 from frntn/patch-1 9 rokov pred
driverapi 71e14dd52a Remove always-on watch for networks and endpoints 9 rokov pred
drivers 23d35bcb4e Merge pull request #611 from sanimej/slice 9 rokov pred
etchosts cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
hostdiscovery 0066225da5 Integration with Docker Discovery 9 rokov pred
idm cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
ipam 268d41835d Make bridge driver networks persistent 9 rokov pred
ipamapi ddcfab5f81 libnetwork <-> ipam driver interaction 9 rokov pred
ipams 2aaef377f3 IPAM driver 9 rokov pred
ipamutils 94b6e5e18b Default IPAM to use ipamutils pkg 9 rokov pred
iptables cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
netlabel bd45253fb5 move Labels from array to map to be consistent with cotnainers 9 rokov pred
netutils cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
ns cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
options cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
osl caab594ffb Moved InterfaceStatistics from osl into types package 10 rokov pred
portallocator cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
portmapper cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
resolvconf e5d44569fb fix the regexp for matching an ip address 9 rokov pred
test 888f13d17b Make the integration tests robust 9 rokov pred
testutils cc02894a50 Move test specific functions to a testutils package. 10 rokov pred
types 02386e85d5 Enable Network labels in backend 9 rokov pred
.gitignore 2aaef377f3 IPAM driver 9 rokov pred
LICENSE d7c688f0f6 Initial commit 10 rokov pred
MAINTAINERS 930d27c06c Add Alessandro as a libnetwork maintainer 10 rokov pred
Makefile ce44f2478d Add overlay network integration test 10 rokov pred
README.md e82989f845 Fix outdated docs and comments 10 rokov pred
ROADMAP.md cc6d1be37e Update ROADMAP.md 10 rokov pred
circle.yml 2c797384ff Report Code Coverage and Add Status Badges 10 rokov pred
controller.go 831e3401f3 Merge pull request #606 from mrjana/model 9 rokov pred
default_gateway.go 51699b91aa Merge pull request #560 from mavenugo/adb 10 rokov pred
drivers.go a226c36b75 Pass down store configs to driver 9 rokov pred
drivers_freebsd.go d565a4df48 Push driver config during `Init` 10 rokov pred
drivers_linux.go d565a4df48 Push driver config during `Init` 10 rokov pred
drivers_windows.go d565a4df48 Push driver config during `Init` 10 rokov pred
endpoint.go 3d3bd9331f Fixed a couple of error messages to address UX related comments 9 rokov pred
endpoint_info.go b9596c89d6 libnetwork to handle allocation of ipv6 9 rokov pred
error.go 3d3bd9331f Fixed a couple of error messages to address UX related comments 9 rokov pred
errors_test.go c70cfcb150 Provide interface to categorize errors 10 rokov pred
libnetwork_internal_test.go 24339bea43 Relax restriction on IpamConfig 9 rokov pred
libnetwork_test.go af3eb25d44 Phase-2 bridge driver changes to support IPAM 9 rokov pred
network.go 50db985c1d Few more fixes identified during integration 9 rokov pred
sandbox.go 1ffe6fef02 Move sandbox resources when container restarts 9 rokov pred
sandbox_externalkey.go a41025e9c0 Fixed a few more issues observed during docker integration 10 rokov pred
sandbox_store.go e41b4765bd Cleanup dangling sandboxes on boot up 9 rokov pred
sandbox_test.go 71e14dd52a Remove always-on watch for networks and endpoints 9 rokov pred
store.go dbbc561c18 Network ep count increment/decrement needs retry 9 rokov pred
store_test.go 284c9cd0f5 Revert "Share libkv store handles across datastore handles" 9 rokov pred
wrapmake.sh ddfa448536 Allow tests to be interrupted 10 rokov pred

README.md

libnetwork - networking for containers

Circle CI Coverage Status GoDoc

Libnetwork provides a native Go implementation for connecting containers

The goal of libnetwork is to deliver a robust Container Network Model that provides a consistent programming interface and the required network abstractions for applications.

NOTE: libnetwork project is under heavy development and is not ready for general use.

Design

Please refer to the design for more information.

Using libnetwork

There are many networking solutions available to suit a broad range of use-cases. libnetwork uses a driver / plugin model to support all of these solutions while abstracting the complexity of the driver implementations by exposing a simple and consistent Network Model to users.

	// Select and configure the network driver
	networkType := "bridge"

	// Create a new controller instance
	driverOptions := options.Generic{}
	genericOption := make(map[string]interface{})
	genericOption[netlabel.GenericData] = driverOptions
	controller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption))
	if err != nil {
		return
	}

	// Create a network for containers to join.
	// NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use.
	network, err := controller.NewNetwork(networkType, "network1")
	if err != nil {
		return
	}

	// For each new container: allocate IP and interfaces. The returned network
	// settings will be used for container infos (inspect and such), as well as
	// iptables rules for port publishing. This info is contained or accessible
	// from the returned endpoint.
	ep, err := network.CreateEndpoint("Endpoint1")
	if err != nil {
		return
	}

	// Create the sandbox for the container.
	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
	sbx, err := controller.NewSandbox("container1",
		libnetwork.OptionHostname("test"),
		libnetwork.OptionDomainname("docker.io"))

	// A sandbox can join the endpoint via the join api.
	err = ep.Join(sbx)
	if err != nil {
		return
	}

	// libnetwork client can check the endpoint's operational data via the Info() API
	epInfo, err := ep.DriverInfo()
	mapData, ok := epInfo[netlabel.PortMap]
	if ok {
		portMapping, ok := mapData.([]types.PortBinding)
		if ok {
			fmt.Printf("Current port mapping for endpoint %s: %v", ep.Name(), portMapping)
		}
	}

Current Status

Please watch this space for updates on the progress.

Currently libnetwork is nothing more than an attempt to modularize the Docker platform's networking subsystem by moving it into libnetwork as a library.

Future

Please refer to roadmap for more information.

Contributing

Want to hack on libnetwork? Docker's contributions guidelines apply.

Copyright and license

Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.