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 Fri, 28 Jul 2017 14:32:02 GMT

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

(Updated July 28, 2017, 10:32 p.m.)


Review request for mesos, Avinash sridharan and Jie Yu.


Changes
-------

Addessed comments.


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 (updated)
-----

  src/docker/docker.hpp 5593cb635e073334c6c2566be3d803cd7febb1c3 
  src/docker/docker.cpp 8081c0203bf62cf62aa3b93d745f0e829ad65509 
  src/docker/executor.cpp e03f24461ec7b19cacae79c020406f0a475f2d19 


Diff: https://reviews.apache.org/r/60558/diff/6/

Changes: https://reviews.apache.org/r/60558/diff/5-6/


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_mode": "CNI",
      "network_name": "net1",
      "dns": {
        "nameservers": [ "8.8.8.8", "8.8.4.4" ]
      }
    }
  ],
  "docker": [
    {
      "network_mode": "BRIDGE",
      "dns": {
        "nameservers": [ "8.8.8.8", "8.8.4.4" ],
        "search": [ "xxx.com", "yyy.com" ],
        "options": [ "timeout:3", "attempts:2" ]
      }
    },
    {
      "network_mode": "USER",
      "network_name": "net2",
      "dns": {
        "nameservers": [ "8.8.8.8", "8.8.4.4" ]
      }
    }
  ]
}
```

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