> On April 5, 2016, 6:25 a.m., Gilbert Song wrote: > > src/cli/execute.cpp, line 152 > > <https://reviews.apache.org/r/45731/diff/1/?file=1325657#file1325657line152> > > > > Should we mention that an image has to be provided && for mesos > > containerizer only? > > Avinash sridharan wrote: > Why do we need an image for this? Also, the `name` field is used to > configure user-defined networks for `DockerContainerizer` as well > (MESOS-4369). > > Qian Zhang wrote: > Agree with Avinash, a container without image can also join the specified > networks. However Gilbert's comment reveals some potential issues in > `mesos-execute`. > > The currently logic > (https://github.com/apache/mesos/blob/0.28.0/src/cli/execute.cpp#L233:L263) > in `mesos-execute` to launch task is: > 1. Check if `--docker_image` is specified. > 2. If it is specfied, then construct `ContainerInfo` based on > `--containerizer` which can be `mesos` or `docker`. > > The problems I see with this logic are: > 1. If `--docker_image` is not specified, then we will NOT construct > `ContainerInfo` at all. This will not be correct when we introduce this > `--networks` flag, because `mesos-execute` should be able to launch a > container joins some networks but without an image. > 2. If `--docker_image` is not specified and `--containerizer` is > `docker`, then the result is we will launch a task with `MesosContainerizer` > which is not expected since what user specifies is `DockerContainerizer`. And > if `MesosContainerizer` is not enabled in agent (e.g., start agent with > `--containerizers=docker`), then the container will be failed to create with > an error like: `None of the enabled containerizers (docker) could create a > container for the provided TaskInfo/ExecutorInfo message`. So I think in this > case, we should guard it in `mesos-execute` rather than leaving it to agent, > i.e., `mesos-execute` should exit with an error message to let user know if > s/he choose `--containerizer=docker`, then s/he must specify `--docker_image` > as well. > > To resolve the above issues, I have updated the patch with a new logic, > please review it and let me know for any comments. > > Avinash sridharan wrote: > Had a discussion with Gilbert. Qian, thanks for the explanation. Based on > this I think Gilbert's comments are valid, since we can't use the --networks > attribute without the image. We should probably throw an error in --networks > is specified but --docker_image is not specified.
Please ignore my last comment, it was a bit hasty. I think the original comment still makes sense. We can launch containers on CNI networks without images. - Avinash ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/45731/#review127043 ----------------------------------------------------------- On April 6, 2016, 7:56 a.m., Qian Zhang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/45731/ > ----------------------------------------------------------- > > (Updated April 6, 2016, 7:56 a.m.) > > > Review request for mesos, Avinash sridharan and Jie Yu. > > > Bugs: MESOS-5117 > https://issues.apache.org/jira/browse/MESOS-5117 > > > Repository: mesos > > > Description > ------- > > Introduced '--networks' flag to mesos-execute. > > > Diffs > ----- > > src/cli/execute.cpp af62f41622e1c43acd8f257c54f8754162c433b8 > > Diff: https://reviews.apache.org/r/45731/diff/ > > > Testing > ------- > > Ran the following command: > `sudo src/mesos-execute --master=192.168.122.171:5050 --name=test > --docker_image=library/busybox --command="sleep 30" --shell=true > --networks=net1,net2` > > The created container successfully joined the CNI networks `net1` and `net2`. > > > Thanks, > > Qian Zhang > >