> On July 9, 2017, 3:09 p.m., Avinash sridharan wrote:
> > Hi Qian, the changes LGTM but I think we should follow these patches up 
> > with a test for CNI and CNM networks?

Definitely, I am working on it now.

And actually I have a comment, in this patch I have handled the case of 
launching a command task with Docker containerizer, in this case, Docker 
executor will be responsible for setting DNS for the container (i.e., the 
command task container) according to `--default_container_dns`. However I see 
there is another case: Docker containerizer can be used to directly launch a 
Docker container as a custom executor 
(DockerContainerizerProcess::launchExecutorContainer()), so for such custom 
executor container, do you think we need to update Docker containerizer to set 
its DNS according to `--default_container_dns`?


- Qian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/60558/#review179994
-----------------------------------------------------------


On July 5, 2017, 3:18 p.m., Qian Zhang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60558/
> -----------------------------------------------------------
> 
> (Updated July 5, 2017, 3:18 p.m.)
> 
> 
> Review request for mesos, Avinash sridharan and Jie Yu.
> 
> 
> Bugs: MESOS-7709
>     https://issues.apache.org/jira/browse/MESOS-7709
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Set container DNS with `--default_container_dns` in Docker executor.
> 
> 
> Diffs
> -----
> 
>   src/docker/docker.hpp 5593cb635e073334c6c2566be3d803cd7febb1c3 
>   src/docker/docker.cpp 8ca0c68836ea5d1a1186e79942f6daccf6c6da46 
>   src/docker/executor.cpp e03f24461ec7b19cacae79c020406f0a475f2d19 
> 
> 
> Diff: https://reviews.apache.org/r/60558/diff/3/
> 
> 
> Testing
> -------
> 
> sudo make check
> 
> 1. Start Mesos master.
> ```
> $ sudo ./bin/mesos-master.sh --work_dir=/opt/mesos
> ```
> 
> 2. Start Mesos agent.
> ```
> $ sudo ./bin/mesos-slave.sh --master=192.168.122.216:5050 
> --containerizers=mesos,docker --image_providers=docker 
> --image_provisioner_backend=aufs 
> --isolation=filesystem/linux,docker/runtime,network/cni,cgroups/cpu,cgroups/mem
>  --network_cni_config_dir=/opt/cni/net_configs 
> --network_cni_plugins_dir=/opt/cni/plugins --work_dir=/opt/mesos 
> --docker_store_dir=/opt/mesos/store/docker 
> --executor_registration_timeout=60mins 
> --default_container_dns=file:///home/stack/dns.json
> 
> $ cat /home/stack/dns.json    
> {
>   "mesos": [
>     {
>       "network": "net1",
>       "dns": {
>         "nameservers": [ "8.8.8.8", "8.8.4.4" ]
>       }
>     }
>   ],
>   "docker": [
>     {
>       "network": "bridge",
>       "dns": {
>         "nameservers": [ "8.8.8.8", "8.8.4.4" ],
>         "search": [ "xxx.com", "yyy.com" ],
>         "options": [ "timeout:3", "attempts:2" ]
>       }
>     }
>   ]
> }
> ```
> 
> 3. Launch a Docker container with `mesos-execute`.
> ```
> $ sudo src/mesos-execute --master=192.168.122.216:5050 
> --task=file:///home/stack/task-docker.json
> 
> $cat /home/stack/task-docker.json 
> {
>   "name": "test",
>   "task_id": {"value" : "test"},
>   "agent_id": {"value" : ""},
>   "resources": [
>     {
>       "name": "cpus",
>       "type": "SCALAR",
>       "scalar": {
>         "value": 0.1
>       }
>     },
>     {
>       "name": "mem",
>       "type": "SCALAR",
>       "scalar": {
>         "value": 32
>       }
>     }
>   ],
>   "command": {
>     "shell": false
>   },
>   "container": {
>     "type": "DOCKER",
>     "docker": {
>       "image": "nginx",
>           "network": "BRIDGE"
>     }
>   }
> }
> ```
> 
> 4. Check the DNS configuration of the Docker container.
> ```
> $ docker ps 
> CONTAINER ID        IMAGE               COMMAND                  CREATED      
>         STATUS              PORTS               NAMES
> ca642bf31a9f        nginx               "nginx -g 'daemon off"   About a 
> minute ago   Up About a minute   80/tcp, 443/tcp     
> mesos-1d48fc32-a138-4c31-a5a9-fd7d279231da
> 
> $ docker exec ca642bf31a9f cat /etc/resolv.conf 
> search xxx.com yyy.com
> nameserver 8.8.8.8
> nameserver 8.8.4.4
> options timeout:3 attempts:2
> ```
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>

Reply via email to