Split the domainname out of qualified hostnames.
Docker doesn't like it when a fully qualified hostname is passed in the `hostname` parameter. When an FQDN is provided with `-h` the official CLI puts the first component in `hostname` and the rest in `domainname`. This change replicates that behavior when the user specifies an FQDN in `hostname` in their `fig.yml`. Signed-off-by: Sam Hanes <sam@maltera.com>
This commit is contained in:
parent
789e1ba82b
commit
699bbe9ca2
2 changed files with 47 additions and 0 deletions
|
|
@ -304,6 +304,17 @@ class Service(object):
|
|||
|
||||
container_options['name'] = self.next_container_name(one_off)
|
||||
|
||||
# If a qualified hostname was given, split it into an
|
||||
# unqualified hostname and a domainname unless domainname
|
||||
# was also given explicitly. This matches the behavior of
|
||||
# the official Docker CLI in that scenario.
|
||||
if ('hostname' in container_options
|
||||
and 'domainname' not in container_options
|
||||
and '.' in container_options['hostname']):
|
||||
parts = container_options['hostname'].partition('.')
|
||||
container_options['hostname'] = parts[0]
|
||||
container_options['domainname'] = parts[2]
|
||||
|
||||
if 'ports' in container_options or 'expose' in self.options:
|
||||
ports = []
|
||||
all_ports = container_options.get('ports', []) + self.options.get('expose', [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue