{"id":13451536,"url":"https://github.com/moby/libnetwork","last_synced_at":"2025-05-13T17:07:14.052Z","repository":{"id":27563992,"uuid":"31046054","full_name":"moby/libnetwork","owner":"moby","description":"networking for containers","archived":false,"fork":false,"pushed_at":"2023-10-20T21:31:26.000Z","size":17811,"stargazers_count":2178,"open_issues_count":210,"forks_count":879,"subscribers_count":169,"default_branch":"master","last_synced_at":"2025-04-23T23:05:09.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ReactiveX/rxjs-docs","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-02-20T01:20:15.000Z","updated_at":"2025-04-21T09:02:13.000Z","dependencies_parsed_at":"2023-02-10T15:01:04.398Z","dependency_job_id":"f7378d00-eef1-45e9-b501-ebaba747e081","html_url":"https://github.com/moby/libnetwork","commit_stats":{"total_commits":1741,"total_committers":240,"mean_commits":7.254166666666666,"dds":0.8236645605973578,"last_synced_commit":"3f0048413d95802b9c6c836eba06bfc54f9dbd03"},"previous_names":["docker/libnetwork"],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moby%2Flibnetwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moby%2Flibnetwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moby%2Flibnetwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moby%2Flibnetwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moby","download_url":"https://codeload.github.com/moby/libnetwork/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250528732,"owners_count":21445516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T07:00:55.428Z","updated_at":"2025-04-23T23:05:22.957Z","avatar_url":"https://github.com/moby.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\u003e **Warning**\n\u003e libnetwork was moved to https://github.com/moby/moby/tree/master/libnetwork\n\u003e\n\u003e libnetwork has been merged to the main repo of Moby since Docker 22.06.\n\u003e\n\u003e The old libnetwork repo (https://github.com/moby/libnetwork) now only accepts PR for Docker 20.10,\n\u003e and will be archived after the EOL of Docker 20.10.\n\n- - -\n# libnetwork - networking for containers\n\n[![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)\n\nLibnetwork provides a native Go implementation for connecting containers\n\nThe goal of libnetwork is to deliver a robust Container Network Model that provides a consistent programming interface and the required network abstractions for applications.\n\n#### Design\nPlease refer to the [design](docs/design.md) for more information.\n\n#### Using libnetwork\n\nThere 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.\n\n\n```go\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/docker/docker/pkg/reexec\"\n\t\"github.com/docker/libnetwork\"\n\t\"github.com/docker/libnetwork/config\"\n\t\"github.com/docker/libnetwork/netlabel\"\n\t\"github.com/docker/libnetwork/options\"\n)\n\nfunc main() {\n\tif reexec.Init() {\n\t\treturn\n\t}\n\n\t// Select and configure the network driver\n\tnetworkType := \"bridge\"\n\n\t// Create a new controller instance\n\tdriverOptions := options.Generic{}\n\tgenericOption := make(map[string]interface{})\n\tgenericOption[netlabel.GenericData] = driverOptions\n\tcontroller, err := libnetwork.New(config.OptionDriverConfig(networkType, genericOption))\n\tif err != nil {\n\t\tlog.Fatalf(\"libnetwork.New: %s\", err)\n\t}\n\n\t// Create a network for containers to join.\n\t// NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use.\n\tnetwork, err := controller.NewNetwork(networkType, \"network1\", \"\")\n\tif err != nil {\n\t\tlog.Fatalf(\"controller.NewNetwork: %s\", err)\n\t}\n\n\t// For each new container: allocate IP and interfaces. The returned network\n\t// settings will be used for container infos (inspect and such), as well as\n\t// iptables rules for port publishing. This info is contained or accessible\n\t// from the returned endpoint.\n\tep, err := network.CreateEndpoint(\"Endpoint1\")\n\tif err != nil {\n\t\tlog.Fatalf(\"network.CreateEndpoint: %s\", err)\n\t}\n\n\t// Create the sandbox for the container.\n\t// NewSandbox accepts Variadic optional arguments which libnetwork can use.\n\tsbx, err := controller.NewSandbox(\"container1\",\n\t\tlibnetwork.OptionHostname(\"test\"),\n\t\tlibnetwork.OptionDomainname(\"docker.io\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"controller.NewSandbox: %s\", err)\n\t}\n\n\t// A sandbox can join the endpoint via the join api.\n\terr = ep.Join(sbx)\n\tif err != nil {\n\t\tlog.Fatalf(\"ep.Join: %s\", err)\n\t}\n\n\t// libnetwork client can check the endpoint's operational data via the Info() API\n\tepInfo, err := ep.DriverInfo()\n\tif err != nil {\n\t\tlog.Fatalf(\"ep.DriverInfo: %s\", err)\n\t}\n\n\tmacAddress, ok := epInfo[netlabel.MacAddress]\n\tif !ok {\n\t\tlog.Fatalf(\"failed to get mac address from endpoint info\")\n\t}\n\n\tfmt.Printf(\"Joined endpoint %s (%s) to sandbox %s (%s)\\n\", ep.Name(), macAddress, sbx.ContainerID(), sbx.Key())\n}\n```\n\n## Contributing\n\nWant to hack on libnetwork? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.\n\n## Copyright and license\nCode and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoby%2Flibnetwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoby%2Flibnetwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoby%2Flibnetwork/lists"}