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

..03-May-2022-

api/H08-Jun-2018-

bitseq/H08-Jun-2018-

client/H08-Jun-2018-

cluster/H08-Jun-2018-

cmd/H08-Jun-2018-

common/H08-Jun-2018-

config/H08-Jun-2018-

datastore/H08-Jun-2018-

diagnostic/H08-Jun-2018-

discoverapi/H08-Jun-2018-

docs/H03-May-2022-

driverapi/H08-Jun-2018-

drivers/H08-Jun-2018-

drvregistry/H08-Jun-2018-

etchosts/H08-Jun-2018-

hostdiscovery/H08-Jun-2018-

idm/H08-Jun-2018-

ipam/H08-Jun-2018-

ipamapi/H08-Jun-2018-

ipams/H08-Jun-2018-

ipamutils/H08-Jun-2018-

iptables/H08-Jun-2018-

ipvs/H08-Jun-2018-

netlabel/H08-Jun-2018-

netutils/H08-Jun-2018-

networkdb/H08-Jun-2018-

ns/H08-Jun-2018-

options/H08-Jun-2018-

osl/H08-Jun-2018-

portallocator/H08-Jun-2018-

portmapper/H08-Jun-2018-

resolvconf/H08-Jun-2018-

test/integration/H08-Jun-2018-

testutils/H08-Jun-2018-

types/H08-Jun-2018-

vendor/H08-Jun-2018-

.gitignoreH A D08-Jun-2018474

CHANGELOG.mdH A D08-Jun-20187.5 KiB

Dockerfile.buildH A D08-Jun-2018320

LICENSEH A D08-Jun-201811.1 KiB

MAINTAINERSH A D08-Jun-20181.3 KiB

MakefileH A D08-Jun-20185.3 KiB

README.mdH A D08-Jun-20183.5 KiB

ROADMAP.mdH A D08-Jun-2018953

VagrantfileH A D08-Jun-20181.8 KiB

agent.goH A D08-Jun-201826.2 KiB

agent.pb.goH A D08-Jun-201827.9 KiB

agent.protoH A D08-Jun-20182.5 KiB

circle.ymlH A D08-Jun-2018363

controller.goH A D08-Jun-201834.4 KiB

default_gateway.goH A D08-Jun-20185.1 KiB

default_gateway_freebsd.goH A D08-Jun-2018326

default_gateway_linux.goH A D08-Jun-2018694

default_gateway_windows.goH A D08-Jun-2018539

drivers_experimental_linux.goH A D08-Jun-2018170

drivers_freebsd.goH A D08-Jun-2018258

drivers_ipam.goH A D08-Jun-2018713

drivers_linux.goH A D08-Jun-2018629

drivers_windows.goH A D08-Jun-2018602

endpoint.goH A D08-Jun-201830.7 KiB

endpoint_cnt.goH A D08-Jun-20183.4 KiB

endpoint_info.goH A D08-Jun-201811.2 KiB

endpoint_info_unix.goH A D08-Jun-2018655

endpoint_info_windows.goH A D08-Jun-2018906

error.goH A D08-Jun-20185.5 KiB

errors_test.goH A D08-Jun-20181.4 KiB

firewall_linux.goH A D08-Jun-20181,008

firewall_others.goH A D08-Jun-201887

libnetwork_internal_test.goH A D08-Jun-201818.1 KiB

libnetwork_linux_test.goH A D08-Jun-201822.5 KiB

libnetwork_test.goH A D08-Jun-201833.3 KiB

machinesH A D08-Jun-20182.4 KiB

network.goH A D08-Jun-201853.1 KiB

network_unix.goH A D08-Jun-2018267

network_windows.goH A D08-Jun-20181.9 KiB

resolver.goH A D08-Jun-201814 KiB

resolver_test.goH A D08-Jun-20186.9 KiB

resolver_unix.goH A D08-Jun-20183 KiB

resolver_windows.goH A D08-Jun-201895

sandbox.goH A D08-Jun-201830.6 KiB

sandbox_dns_unix.goH A D08-Jun-201811.8 KiB

sandbox_dns_windows.goH A D08-Jun-2018566

sandbox_externalkey.goH A D08-Jun-2018209

sandbox_externalkey_unix.goH A D08-Jun-20183.9 KiB

sandbox_externalkey_windows.goH A D08-Jun-20181.3 KiB

sandbox_store.goH A D08-Jun-20186.9 KiB

sandbox_test.goH A D08-Jun-20186 KiB

service.goH A D08-Jun-20182.3 KiB

service_common.goH A D08-Jun-201811.8 KiB

service_common_test.goH A D08-Jun-20183 KiB

service_linux.goH A D08-Jun-201822.7 KiB

service_unsupported.goH A D08-Jun-2018595

service_windows.goH A D08-Jun-20184.1 KiB

store.goH A D08-Jun-201811.4 KiB

store_linux_test.goH A D08-Jun-20181.4 KiB

store_test.goH A D08-Jun-20183.5 KiB

support.shH A D08-Jun-20184 KiB

vendor.confH A D08-Jun-20183.1 KiB

wrapmake.shH A D08-Jun-2018101

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) [![Go Report Card](https://goreportcard.com/badge/github.com/docker/libnetwork)](https://goreportcard.com/report/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