mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qian Zhang <zhq527...@gmail.com>
Subject Re: Review Request 60558: Set container DNS with `--default_container_dns` in Docker executor.
Date Wed, 05 Jul 2017 07:18:46 GMT


> On July 4, 2017, 2:35 a.m., Avinash sridharan wrote:
> > src/docker/docker.hpp
> > Lines 167 (patched)
> > <https://reviews.apache.org/r/60558/diff/1/?file=1767463#file1767463line168>
> >
> >     For consistency can we use `defautlContainerDNS`?
> 
> Qian Zhang wrote:
>     Originally I used `defautlContainerDNS`, but that will make this line exceeding 80
chars :-( I think it also makes sense to use `defaultDNS` since here we know we are creating
run options for Docker container, so I think we do not have to mention `container` in the
parameter name.
> 
> Avinash sridharan wrote:
>     You can use this `// NOLINT(whitespace/line_length)` to create exceptions? In `executor.cpp`
you use `defaultContainerDNS` so seemed a bit odd.

Agree!


- Qian


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


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
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message