From 90cd9b2c1ddefffa6a02addbc24718fd2e9bf3d7 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Mon, 16 Sep 2019 17:18:17 +0200 Subject: docker-compose: Align hosts with hostname When using Docker CE 19.x, `hostname -d` fails to properly resolve the domainname due to changes in the way Docker sets it inside the container. Work around this issue by aligning the contents of `/etc/hostname` with `/etc/hosts`, so `hostname -d` can properly determine the domain name. This also requires calling `hostname -b` via cfg01 entrypoint.sh. Change-Id: I697b5d9882e3d6641712a00bca10012800ee1898 Signed-off-by: Alexandru Avadanii --- mcp/scripts/.gitignore | 1 + mcp/scripts/docker-compose/files/entrypoint.sh | 5 +++++ mcp/scripts/docker-compose/files/hosts | 6 ------ mcp/scripts/docker-compose/files/hosts.j2 | 7 +++++++ 4 files changed, 13 insertions(+), 6 deletions(-) delete mode 100644 mcp/scripts/docker-compose/files/hosts create mode 100644 mcp/scripts/docker-compose/files/hosts.j2 (limited to 'mcp/scripts') diff --git a/mcp/scripts/.gitignore b/mcp/scripts/.gitignore index c21c3d9de..d89d60722 100644 --- a/mcp/scripts/.gitignore +++ b/mcp/scripts/.gitignore @@ -2,3 +2,4 @@ mcp.rsa* user-data.sh xdf_data.sh docker-compose/files/entrypoint_maas.sh +docker-compose/files/hosts diff --git a/mcp/scripts/docker-compose/files/entrypoint.sh b/mcp/scripts/docker-compose/files/entrypoint.sh index b50dd2761..caa50a998 100755 --- a/mcp/scripts/docker-compose/files/entrypoint.sh +++ b/mcp/scripts/docker-compose/files/entrypoint.sh @@ -89,6 +89,11 @@ find -L /srv/salt /srv/salt/env/prd/_* -maxdepth 1 -type l -delete # Fix up any permissions after above file shuffling chown root:root -R /srv/salt +# Docker-ce 19.x+ workaround for broken domainname setup +# shellcheck source=/dev/null +source /root/fuel/mcp/scripts/xdf_data.sh +hostname -b "cfg01.${CLUSTER_DOMAIN}" + service ssh start service salt-minion start diff --git a/mcp/scripts/docker-compose/files/hosts b/mcp/scripts/docker-compose/files/hosts deleted file mode 100644 index 473184145..000000000 --- a/mcp/scripts/docker-compose/files/hosts +++ /dev/null @@ -1,6 +0,0 @@ -127.0.0.1 localhost -::1 localhost ip6-localhost ip6-loopback -fe00::0 ip6-localnet -ff00::0 ip6-mcastprefix -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters diff --git a/mcp/scripts/docker-compose/files/hosts.j2 b/mcp/scripts/docker-compose/files/hosts.j2 new file mode 100644 index 000000000..b42c5a088 --- /dev/null +++ b/mcp/scripts/docker-compose/files/hosts.j2 @@ -0,0 +1,7 @@ +{{ conf.SALT_MASTER }} cfg01.{{ conf.cluster.domain }} +127.0.0.1 localhost +::1 localhost ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters -- cgit 1.2.3-korg