mirror of https://github.com/docker/compose.git
Merge pull request #476 from salehe/dns-search
Add dns_search support in yml config
This commit is contained in:
commit
cb1a5e0a24
11
docs/yml.md
11
docs/yml.md
|
@ -171,6 +171,17 @@ cap_drop:
|
||||||
- SYS_ADMIN
|
- SYS_ADMIN
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### dns_search
|
||||||
|
|
||||||
|
Custom DNS search domains. Can be a single value or a list.
|
||||||
|
|
||||||
|
```
|
||||||
|
dns_search: example.com
|
||||||
|
dns_search:
|
||||||
|
- dc1.example.com
|
||||||
|
- dc2.example.com
|
||||||
|
```
|
||||||
|
|
||||||
### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart
|
### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart
|
||||||
|
|
||||||
Each of these is a single value, analogous to its [docker run](https://docs.docker.com/reference/run/) counterpart.
|
Each of these is a single value, analogous to its [docker run](https://docs.docker.com/reference/run/) counterpart.
|
||||||
|
|
|
@ -21,6 +21,7 @@ DOCKER_CONFIG_KEYS = [
|
||||||
'command',
|
'command',
|
||||||
'detach',
|
'detach',
|
||||||
'dns',
|
'dns',
|
||||||
|
'dns_search',
|
||||||
'domainname',
|
'domainname',
|
||||||
'entrypoint',
|
'entrypoint',
|
||||||
'env_file',
|
'env_file',
|
||||||
|
@ -284,6 +285,7 @@ class Service(object):
|
||||||
privileged = options.get('privileged', False)
|
privileged = options.get('privileged', False)
|
||||||
net = options.get('net', 'bridge')
|
net = options.get('net', 'bridge')
|
||||||
dns = options.get('dns', None)
|
dns = options.get('dns', None)
|
||||||
|
dns_search = options.get('dns_search', None)
|
||||||
cap_add = options.get('cap_add', None)
|
cap_add = options.get('cap_add', None)
|
||||||
cap_drop = options.get('cap_drop', None)
|
cap_drop = options.get('cap_drop', None)
|
||||||
|
|
||||||
|
@ -297,6 +299,7 @@ class Service(object):
|
||||||
privileged=privileged,
|
privileged=privileged,
|
||||||
network_mode=net,
|
network_mode=net,
|
||||||
dns=dns,
|
dns=dns,
|
||||||
|
dns_search=dns_search,
|
||||||
restart_policy=restart,
|
restart_policy=restart,
|
||||||
cap_add=cap_add,
|
cap_add=cap_add,
|
||||||
cap_drop=cap_drop,
|
cap_drop=cap_drop,
|
||||||
|
@ -407,7 +410,7 @@ class Service(object):
|
||||||
container_options['image'] = self._get_image_name(container_options['image'])
|
container_options['image'] = self._get_image_name(container_options['image'])
|
||||||
|
|
||||||
# Delete options which are only used when starting
|
# Delete options which are only used when starting
|
||||||
for key in ['privileged', 'net', 'dns', 'restart', 'cap_add', 'cap_drop', 'env_file']:
|
for key in ['privileged', 'net', 'dns', 'dns_search', 'restart', 'cap_add', 'cap_drop', 'env_file']:
|
||||||
if key in container_options:
|
if key in container_options:
|
||||||
del container_options[key]
|
del container_options[key]
|
||||||
|
|
||||||
|
|
|
@ -397,6 +397,16 @@ class ServiceTest(DockerClientTestCase):
|
||||||
container = service.start_container().inspect()
|
container = service.start_container().inspect()
|
||||||
self.assertEqual(container['HostConfig']['CapDrop'], ['SYS_ADMIN', 'NET_ADMIN'])
|
self.assertEqual(container['HostConfig']['CapDrop'], ['SYS_ADMIN', 'NET_ADMIN'])
|
||||||
|
|
||||||
|
def test_dns_search_single_value(self):
|
||||||
|
service = self.create_service('web', dns_search='example.com')
|
||||||
|
container = service.start_container().inspect()
|
||||||
|
self.assertEqual(container['HostConfig']['DnsSearch'], ['example.com'])
|
||||||
|
|
||||||
|
def test_dns_search_list(self):
|
||||||
|
service = self.create_service('web', dns_search=['dc1.example.com', 'dc2.example.com'])
|
||||||
|
container = service.start_container().inspect()
|
||||||
|
self.assertEqual(container['HostConfig']['DnsSearch'], ['dc1.example.com', 'dc2.example.com'])
|
||||||
|
|
||||||
def test_working_dir_param(self):
|
def test_working_dir_param(self):
|
||||||
service = self.create_service('container', working_dir='/working/dir/sample')
|
service = self.create_service('container', working_dir='/working/dir/sample')
|
||||||
container = service.create_container().inspect()
|
container = service.create_container().inspect()
|
||||||
|
|
Loading…
Reference in New Issue