1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/libnetwork
Madhu Venugopal 74376e8676 Moved the default local and global store to new root
This is required in order to provide a clean switchover.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-11 22:57:24 -07:00
..
api move Labels from array to map to be consistent with cotnainers 2015-10-09 11:08:13 -07:00
bitseq Remove 2^32 bits restriction on bitsequence 2015-10-10 05:42:26 -07:00
client Enable network labels in Rest API 2015-10-09 01:06:20 -07:00
cmd Enable network labels in Rest API 2015-10-09 01:06:20 -07:00
config Moved the default local and global store to new root 2015-10-11 22:57:24 -07:00
datastore Moved the default local and global store to new root 2015-10-11 22:57:24 -07:00
docs
driverapi
drivers Merge pull request #629 from sanimej/slice 2015-10-10 13:01:52 -07:00
etchosts
Godeps Update libkv godeps 2015-10-11 16:02:16 -07:00
hostdiscovery
idm Remove 2^32 bits restriction on bitsequence 2015-10-10 05:42:26 -07:00
ipam Reduce logging verbosity in allocator 2015-10-10 05:42:31 -07:00
ipamapi
ipams
ipamutils Make ipamutils compile for windows 2015-10-10 13:16:52 -07:00
iptables
netlabel move Labels from array to map to be consistent with cotnainers 2015-10-09 11:08:13 -07:00
netutils
ns
options
osl
portallocator
portmapper
resolvconf
test/integration Make the integration tests robust 2015-10-09 00:06:51 -07:00
testutils
types Enable Network labels in backend 2015-10-09 01:06:15 -07:00
.gitignore
circle.yml
controller.go
default_gateway.go
drivers.go
drivers_freebsd.go
drivers_linux.go
drivers_windows.go
endpoint.go Fixed a couple of error messages to address UX related comments 2015-10-09 01:45:24 -07:00
endpoint_info.go
error.go Fixed a couple of error messages to address UX related comments 2015-10-09 01:45:24 -07:00
errors_test.go
libnetwork_internal_test.go Relax restriction on IpamConfig 2015-10-09 17:54:28 -07:00
libnetwork_test.go Remove 2^32 bits restriction on bitsequence 2015-10-10 05:42:26 -07:00
LICENSE
MAINTAINERS
Makefile
network.go Merge pull request #623 from aboch/ipc 2015-10-10 11:09:55 -07:00
README.md
ROADMAP.md
sandbox.go Move sandbox resources when container restarts 2015-10-09 13:43:25 -07:00
sandbox_externalkey.go
sandbox_store.go Reduce logging verbosity in allocator 2015-10-10 05:42:31 -07:00
sandbox_test.go
store.go Network ep count increment/decrement needs retry 2015-10-09 19:37:25 -07:00
store_test.go
wrapmake.sh

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.

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