Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding custom bridge support to docker run #6704

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding custom bridge support in docker.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
  • Loading branch information
vishh committed Jul 11, 2014
commit f7a4aae9c5edb3c1222f7d7fad8f27eeaa62bbb7
6 changes: 4 additions & 2 deletions daemon/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,11 @@ func (container *Container) allocateNetwork() error {
eng = container.daemon.eng
)

// TODO(vishh): Handle custom bridge.
job := eng.Job("allocate_interface", container.ID)
if bridgeToUse := mode.GetNonDefaultBridge(); bridgeToUse != "" {
job.Setenv("RequestedBridge", bridgeToUse)
}

if env, err = job.Stdout.AddEnv(); err != nil {
return err
}
Expand Down Expand Up @@ -947,7 +950,6 @@ func (container *Container) initializeNetworking() error {
container.Config.NetworkDisabled = true
return container.buildHostnameAndHostsFiles("127.0.1.1")
} else {
// TODO(vishh): Handle custom bridge.
if err := container.allocateNetwork(); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion runconfig/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
flWorkingDir = cmd.String([]string{"w", "-workdir"}, "", "Working directory inside the container")
flCpuShares = cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)")
flCpuset = cmd.String([]string{"-cpuset"}, "", "CPUs in which to allow execution (0-3, 0,1)")
flNetMode = cmd.String([]string{"-net"}, "bridge", "Set the Network mode for the container\n'bridge': creates a new network stack for the container on the docker bridge\n'none': no networking for this container\n'container:<name|id>': reuses another container network stack\n'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.")
flNetMode = cmd.String([]string{"-net"}, "bridge", "Set the Network mode for the container\n'bridge': creates a new network stack for the container on the docker bridge\n'none': no networking for this container\n'bridge:<custom bridge>': creates a new network stack for the container on the user specified custom bridge\n'container:<name|id>': reuses another container network stack\n'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.")
// For documentation purpose
_ = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxify received signals to the process (even in non-TTY mode). SIGCHLD is not proxied.")
_ = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container")
Expand Down