From d2bc825db6d9a709d836140ce0a69b4828594f02 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 10 Dec 2021 08:20:38 +0200 Subject: [PATCH] [build]: Add possibility to override dockerd config file for multiarch builds. (#9325) - Why I did it Fixes #8898 Dockerd for multiarch build by default use host OS config file ("/etc/docker/daemon.json"). Default configuration used on host OS may not work for containers run inside sonic-slave. "DOCKER_CONFIG_FILE_FOR_MULTIARCH" variable allows overriding path to the config file that will be used for multiarch dockerd. - How I did it Added "DOCKER_CONFIG_FILE_FOR_MULTIARCH" to Makefile.work file that allow to override path to dockerd config file through environment variable: DOCKER_CONFIG_FILE_FOR_MULTIARCH=${path_to_file}/daemon.json make ... If the env variable is not set build the system preserves its default behavior. - How to verify it Set DOCKER_CONFIG_FILE_FOR_MULTIARCH env variable Run build While build is running execute ps -eo pid,cmd | grep "[0-9] dockerd.*march" command Verify that --config-file parameter is set to the same path that was specified in DOCKER_CONFIG_FILE_FOR_MULTIARCH variable. --- Makefile.work | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.work b/Makefile.work index ccaacf749a..d9688a752d 100644 --- a/Makefile.work +++ b/Makefile.work @@ -197,6 +197,11 @@ endif SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH := dockerd --experimental=true --storage-driver=vfs \ --data-root=$(DOCKER_DATA_ROOT_FOR_MULTIARCH) --exec-root=/var/run/march/docker/ \ -H unix:///var/run/march/docker.sock -p /var/run/march/docker.pid + +ifneq ($(DOCKER_CONFIG_FILE_FOR_MULTIARCH),) + SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH += --config-file=$(DOCKER_CONFIG_FILE_FOR_MULTIARCH) +endif + DOCKER_RUN += -v /var/run/march/docker.sock:/var/run/docker.sock DOCKER_RUN += -v /var/run/march/docker.pid:/var/run/docker.pid DOCKER_RUN += -v /var/run/march/docker:/var/run/docker