[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH] tests/docker: Allow passing --network option when building i

From: Philippe Mathieu-Daudé
Subject: [RFC PATCH] tests/docker: Allow passing --network option when building images
Date: Tue, 19 Jan 2021 06:45:02 +0100

When using the Docker engine, build fails because the container is
unable to resolve hostnames:

  $ make docker-image-debian-s390x-cross NETWORK=host ENGINE=docker
    BUILD   debian10
  #6 9.679 Err:1 http://deb.debian.org/debian buster InRelease
  #6 9.679   Temporary failure resolving 'deb.debian.org'
  #6 16.69 Err:2 http://security.debian.org/debian-security buster/updates 
  #6 16.69   Temporary failure resolving 'security.debian.org'
  #6 22.69 Err:3 http://deb.debian.org/debian buster-updates InRelease
  #6 22.69   Temporary failure resolving 'deb.debian.org'
  #6 22.74 W: Failed to fetch 
http://deb.debian.org/debian/dists/buster/InRelease  Temporary failure 
resolving 'deb.debian.org'
  #6 22.74 W: Failed to fetch 
Temporary failure resolving 'security.debian.org'
  #6 22.74 W: Failed to fetch 
http://deb.debian.org/debian/dists/buster-updates/InRelease  Temporary failure 
resolving 'deb.debian.org'
  #6 22.74 W: Some index files failed to download. They have been ignored, or 
old ones used instead.
  Traceback (most recent call last):
    File "./tests/docker/docker.py", line 709, in <module>
    File "./tests/docker/docker.py", line 705, in main
      return args.cmdobj.run(args, argv)
    File "./tests/docker/docker.py", line 498, in run
      dkr.build_image(tag, docker_dir, dockerfile,
    File "./tests/docker/docker.py", line 353, in build_image
    File "./tests/docker/docker.py", line 244, in _do_check
      return subprocess.check_call(self._command + cmd, **kwargs)
    File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  make: *** [tests/docker/Makefile.include:61: docker-image-debian10] Error 1

Fix by passing the NETWORK variable with --network= argument.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
 tests/docker/Makefile.include | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index bdc53ddfcf9..b65fd684011 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -63,6 +63,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
                $(if $V,,--quiet) \
                $(if $(NOCACHE),--no-cache, \
                        $(if $(DOCKER_REGISTRY),--registry $(DOCKER_REGISTRY))) 
+               $(if $(NETWORK),$(if $(subst 
$(NETWORK),,1),--network=$(NETWORK))) \
                $(if $(NOUSER),,--add-current-user) \
                $(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
                $(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\

reply via email to

[Prev in Thread] Current Thread [Next in Thread]