Skip to content

Commit

Permalink
daemon: Use short libnetwork ID in exec-root & update libnetwork
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Millar <[email protected]>
  • Loading branch information
Rid committed Oct 15, 2019
1 parent 7521bd1 commit df7b8f4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 34 deletions.
4 changes: 3 additions & 1 deletion builder/builder-next/executor_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/docker/docker/daemon/config"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/libnetwork"
"github.com/moby/buildkit/executor"
"github.com/moby/buildkit/executor/oci"
Expand Down Expand Up @@ -100,11 +101,12 @@ func (iface *lnInterface) Set(s *specs.Spec) {
logrus.WithError(iface.err).Error("failed to set networking spec")
return
}
shortNetCtlrID := stringid.TruncateID(iface.provider.NetworkController.ID())
// attach netns to bridge within the container namespace, using reexec in a prestart hook
s.Hooks = &specs.Hooks{
Prestart: []specs.Hook{{
Path: filepath.Join("/proc", strconv.Itoa(os.Getpid()), "exe"),
Args: []string{"libnetwork-setkey", "-exec-root=" + iface.provider.Config().Daemon.ExecRoot, iface.sbx.ContainerID(), iface.provider.NetworkController.ID()},
Args: []string{"libnetwork-setkey", "-exec-root=" + iface.provider.Config().Daemon.ExecRoot, iface.sbx.ContainerID(), shortNetCtlrID},
}},
}
}
Expand Down
4 changes: 3 additions & 1 deletion daemon/oci_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/docker/docker/oci/caps"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/rootless/specconv"
volumemounts "github.com/docker/docker/volume/mounts"
"github.com/opencontainers/runc/libcontainer/apparmor"
Expand Down Expand Up @@ -66,13 +67,14 @@ func WithLibnetwork(daemon *Daemon, c *container.Container) coci.SpecOpts {
for _, ns := range s.Linux.Namespaces {
if ns.Type == "network" && ns.Path == "" && !c.Config.NetworkDisabled {
target := filepath.Join("/proc", strconv.Itoa(os.Getpid()), "exe")
shortNetCtlrID := stringid.TruncateID(daemon.netController.ID())
s.Hooks.Prestart = append(s.Hooks.Prestart, specs.Hook{
Path: target,
Args: []string{
"libnetwork-setkey",
"-exec-root=" + daemon.configStore.GetExecRoot(),
c.ID,
daemon.netController.ID(),
shortNetCtlrID,
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/proxy.installer
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# LIBNETWORK_COMMIT is used to build the docker-userland-proxy binary. When
# updating the binary version, consider updating github.com/docker/libnetwork
# in vendor.conf accordingly
: ${LIBNETWORK_COMMIT:=96bcc0dae898308ed659c5095526788a602f4726}
: ${LIBNETWORK_COMMIT:=0025177e3dabbe0de151be0957dcaff149d43536}

install_proxy() {
case "$1" in
Expand Down
2 changes: 1 addition & 1 deletion vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ github.com/gofrs/flock 392e7fae8f1b0bdbd67dad7237d2
# libnetwork

# When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
github.com/docker/libnetwork 96bcc0dae898308ed659c5095526788a602f4726
github.com/docker/libnetwork 0025177e3dabbe0de151be0957dcaff149d43536
github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions vendor/github.com/docker/libnetwork/ipvs/constants.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 7 additions & 22 deletions vendor/github.com/docker/libnetwork/store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit df7b8f4

Please sign in to comment.