> On 三月 9, 2016, 2:21 a.m., Guangya Liu wrote: > > src/docker/docker.cpp, lines 306-307 > > <https://reviews.apache.org/r/44531/diff/1/?file=1292300#file1292300line306> > > > > I found that the NetworkMode is `default` when using `bridge` mode, so > > the value of `networkModeValue` would be `default` but not `bridge`, and > > this will cause line 315 constrcut a invalid addressLocation as > > `NetworkSettings.Networks.default.IPAddress` which will always failed and > > thus fall to old API. > > Travis Hegner wrote: > I've found this to be true with at least docker 1.10.2. > > Is it possible to launch a container with "--net default" (or ommitted) > and have it not be a "bridge" in general with docker? I haven't determined > that yet. If not, then we could statically test for "default" and set the > string to "bridge" every time. Another thing to consider, if mesos /always/ > launches a container with an explicit "--net bridge" or "--net host" > parameter (until UDNs are implemented anyway), then we aren't really in > danger of exposing the behavior described in this issue. Launching the > container with an explicit "--net bridge" sets the NetworkMode field to > "bridge" as well. > > Guangya Liu wrote: > I was using 1.10.0, and the default value of net is `--net=default` and > it also works if I run the command `docker run -it --net default ubuntu:14.04 > /bin/bash` > > Travis Hegner wrote: > Do you know if it's possible to run a container with "--net=default" and > have the container running in something _other_ than "brige" mode? Is there > an option you can pass to the daemon to set the "default" networkMode to > something other than "bridge"? > > Dan Osborne wrote: > @Travis I'm unable to reproduce the behavior you are describing when > launching containers with docker 1.10.2: > > ``` > [vagrant@mesos-02 ~]$ docker run --name=test1 -d --net=bridge busybox > sleep 360 > 52e8b0a1951a851708194278d55ea02065d405c518c35c69d52eb325f2682a05 > [vagrant@mesos-02 ~]$ docker inspect > --format='{{.HostConfig.NetworkMode}}' test1 > bridge > ``` > > It appropriately returns 'bridge', not 'default'. > > Travis Hegner wrote: > Yes, when you pass bridge, networkMode is bridge. It's when you pass > "default" or omit the net parameter altogether, then networkMode is > "default", but the actual object name in the Networks list is "bridge". > > If anyone can confirm that mesos currently **always** supplies a --net > parameter, and it is never currently set to "default", then this issue is not > a problem, as a mesos container will never have a mismatched "networkMode" > and actual "Network.[name]". > > Dan Osborne wrote: > Ah, thank you for clarifiying, I figured I wasn't understanding correctly. > > I can confirm that mesos always supplies a --net parameter when launching > a docker container, and it is always host, bridge, or none. See [Line 514 in > docker.cpp](https://github.com/apache/mesos/blob/0.28.0-rc1/src/docker/docker.cpp#L514) > > Guangya Liu wrote: > Yes, Mesos only support host, bridge and None, and the default value is > host for now. Mesos do not support `default` now, so I think that this patch > is ok for current logic.
Related code are here: https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto#L1625-L1631 - Guangya ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/44531/#review122657 ----------------------------------------------------------- On 三月 8, 2016, 10:54 p.m., Timothy Chen wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/44531/ > ----------------------------------------------------------- > > (Updated 三月 8, 2016, 10:54 p.m.) > > > Review request for mesos, Dan Osborne, Jie Yu, and Travis Hegner. > > > Bugs: MESOS-4370 > https://issues.apache.org/jira/browse/MESOS-4370 > > > Repository: mesos > > > Description > ------- > > Fixed parsing network ip address with docker. > > > Diffs > ----- > > src/docker/docker.cpp 52728707d985517e57525af7e470ccb468039373 > > Diff: https://reviews.apache.org/r/44531/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Timothy Chen > >