From 72f7b086d757324e030bf9ec25b3f4cfe20b34ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rodrigues?= Date: Wed, 10 Feb 2021 15:52:11 +0100 Subject: [PATCH] Add missing --add-host args to the build command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Rodrigues --- compose/service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compose/service.py b/compose/service.py index c3ee0201a..3829e8269 100644 --- a/compose/service.py +++ b/compose/service.py @@ -1875,6 +1875,11 @@ class _CLIBuilder: command_builder.add_arg("--iidfile", iidfile) command_builder.add_arg("--platform", platform) command_builder.add_arg("--isolation", isolation) + + if extra_hosts: + for host, ip in extra_hosts.items(): + command_builder.add_arg("--add-host", "{}:{}".format(host, ip)) + args = command_builder.build([path]) magic_word = "Successfully built "