• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..06-Dec-2017-

bitseq/H06-Dec-2017-856649

cluster/H06-Dec-2017-3726

common/H06-Dec-2017-166121

config/H06-Dec-2017-299232

datastore/H06-Dec-2017-970682

diagnose/H06-Dec-2017-13489

discoverapi/H06-Dec-2017-6135

driverapi/H06-Dec-2017-375204

drivers/H06-Dec-2017-14,63811,485

drvregistry/H06-Dec-2017-229163

etchosts/H06-Dec-2017-209156

hostdiscovery/H06-Dec-2017-145114

idm/H06-Dec-2017-7754

ipam/H06-Dec-2017-1,192923

ipamapi/H06-Dec-2017-10852

ipams/H06-Dec-2017-537395

ipamutils/H06-Dec-2017-5138

iptables/H06-Dec-2017-763585

ipvs/H06-Dec-2017-871599

netlabel/H06-Dec-2017-13065

netutils/H06-Dec-2017-372262

networkdb/H06-Dec-2017-5,6274,663

ns/H06-Dec-2017-141115

options/H06-Dec-2017-8956

osl/H06-Dec-2017-1,8681,346

portallocator/H06-Dec-2017-320251

portmapper/H06-Dec-2017-420337

resolvconf/H06-Dec-2017-284207

types/H06-Dec-2017-637441

LICENSEH A D06-Dec-201711.1 KiB203169

README.mdH A D06-Dec-20173.3 KiB9068

agent.goH A D06-Dec-201723.7 KiB914739

agent.pb.goH A D06-Dec-201726.3 KiB1,004935

agent.protoH A D06-Dec-20172.4 KiB7355

controller.goH A D06-Dec-201733.3 KiB1,294969

default_gateway.goH A D06-Dec-20175.1 KiB202144

default_gateway_freebsd.goH A D06-Dec-2017326 149

default_gateway_linux.goH A D06-Dec-2017694 3325

default_gateway_windows.goH A D06-Dec-2017539 2317

drivers_experimental_linux.goH A D06-Dec-2017170 107

drivers_freebsd.goH A D06-Dec-2017258 1411

drivers_ipam.goH A D06-Dec-2017580 2420

drivers_linux.goH A D06-Dec-2017629 2723

drivers_windows.goH A D06-Dec-2017602 2219

endpoint.goH A D06-Dec-201730.5 KiB1,207947

endpoint_cnt.goH A D06-Dec-20173.4 KiB183147

endpoint_info.goH A D06-Dec-201711.2 KiB453358

endpoint_info_unix.goH A D06-Dec-2017655 3122

endpoint_info_windows.goH A D06-Dec-2017906 4634

error.goH A D06-Dec-20175.5 KiB19499

firewall_linux.goH A D06-Dec-2017827 3021

firewall_others.goH A D06-Dec-201771 73

network.goH A D06-Dec-201752.9 KiB2,1331,680

network_unix.goH A D06-Dec-2017267 157

network_windows.goH A D06-Dec-20171.8 KiB7359

resolver.goH A D06-Dec-201713.1 KiB534418

resolver_unix.goH A D06-Dec-20173 KiB10282

resolver_windows.goH A D06-Dec-201795 84

sandbox.goH A D06-Dec-201729.8 KiB1,230913

sandbox_dns_unix.goH A D06-Dec-201711.6 KiB416321

sandbox_dns_windows.goH A D06-Dec-2017566 3621

sandbox_externalkey.goH A D06-Dec-2017209 139

sandbox_externalkey_unix.goH A D06-Dec-20173.9 KiB177141

sandbox_externalkey_windows.goH A D06-Dec-20171.3 KiB4627

sandbox_store.goH A D06-Dec-20176.9 KiB306245

service.goH A D06-Dec-20172.3 KiB9453

service_common.goH A D06-Dec-201711.5 KiB386278

service_linux.goH A D06-Dec-201722.1 KiB782613

service_unsupported.goH A D06-Dec-2017595 2617

service_windows.goH A D06-Dec-20173.8 KiB151116

store.goH A D06-Dec-201711.4 KiB497388

vendor.confH A D06-Dec-20172.9 KiB5451

README.md

1# libnetwork - networking for containers
2
3[![Circle CI](https://circleci.com/gh/docker/libnetwork/tree/master.svg?style=svg)](https://circleci.com/gh/docker/libnetwork/tree/master) [![Coverage Status](https://coveralls.io/repos/docker/libnetwork/badge.svg)](https://coveralls.io/r/docker/libnetwork) [![GoDoc](https://godoc.org/github.com/docker/libnetwork?status.svg)](https://godoc.org/github.com/docker/libnetwork)
4
5Libnetwork provides a native Go implementation for connecting containers
6
7The goal of libnetwork is to deliver a robust Container Network Model that provides a consistent programming interface and the required network abstractions for applications.
8
9#### Design
10Please refer to the [design](docs/design.md) for more information.
11
12#### Using libnetwork
13
14There 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.
15
16
17```go
18func main() {
19	if reexec.Init() {
20		return
21	}
22
23	// Select and configure the network driver
24	networkType := "bridge"
25
26	// Create a new controller instance
27	driverOptions := options.Generic{}
28	genericOption := make(map[string]interface{})
29	genericOption[netlabel.GenericData] = driverOptions
30	controller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption))
31	if err != nil {
32		log.Fatalf("libnetwork.New: %s", err)
33	}
34
35	// Create a network for containers to join.
36	// NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use.
37	network, err := controller.NewNetwork(networkType, "network1", "")
38	if err != nil {
39		log.Fatalf("controller.NewNetwork: %s", err)
40	}
41
42	// For each new container: allocate IP and interfaces. The returned network
43	// settings will be used for container infos (inspect and such), as well as
44	// iptables rules for port publishing. This info is contained or accessible
45	// from the returned endpoint.
46	ep, err := network.CreateEndpoint("Endpoint1")
47	if err != nil {
48		log.Fatalf("network.CreateEndpoint: %s", err)
49	}
50
51	// Create the sandbox for the container.
52	// NewSandbox accepts Variadic optional arguments which libnetwork can use.
53	sbx, err := controller.NewSandbox("container1",
54		libnetwork.OptionHostname("test"),
55		libnetwork.OptionDomainname("docker.io"))
56	if err != nil {
57		log.Fatalf("controller.NewSandbox: %s", err)
58	}
59
60	// A sandbox can join the endpoint via the join api.
61	err = ep.Join(sbx)
62	if err != nil {
63		log.Fatalf("ep.Join: %s", err)
64	}
65
66	// libnetwork client can check the endpoint's operational data via the Info() API
67	epInfo, err := ep.DriverInfo()
68	if err != nil {
69		log.Fatalf("ep.DriverInfo: %s", err)
70	}
71
72	macAddress, ok := epInfo[netlabel.MacAddress]
73	if !ok {
74		log.Fatalf("failed to get mac address from endpoint info")
75	}
76
77	fmt.Printf("Joined endpoint %s (%s) to sandbox %s (%s)\n", ep.Name(), macAddress, sbx.ContainerID(), sbx.Key())
78}
79```
80
81## Future
82Please refer to [roadmap](ROADMAP.md) for more information.
83
84## Contributing
85
86Want to hack on libnetwork? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.
87
88## Copyright and license
89Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.
90