On Wed, Nov 11, 2020 at 06:18:15PM +0800, Liu Yinsi wrote:
[why] when build kibana images in x86_machine, error message:
standard_init_linux.go:220: exec user process caused "exec format error" libcontainer: container start initialization failed: standard_init_linux.go:220: exec user process caused "exec format error" The command '/bin/sh -c sed -i 's/server.host: "0"/server.host: "0.0.0.0"/' config/kibana.yml' returned a non-zero code: 1
because arm base image not support to build in x86 machine.
[how]
- use images dict to store arm and x86 base images
- use $(arch) to choose base image according to different system architecture
Signed-off-by: Liu Yinsi liuyinsi@163.com
container/kibana/Dockerfile | 4 +++- container/kibana/build | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/container/kibana/Dockerfile b/container/kibana/Dockerfile index 35802fe..6e0dba0 100644 --- a/container/kibana/Dockerfile +++ b/container/kibana/Dockerfile @@ -1,7 +1,9 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
-FROM gagara/kibana-oss-arm64:7.6.2 +ARG BASE_IMAGE
+FROM BASE_IMAGE
# docker image borrowed from hub.docker.com/r/gagara/kibana-oss-arm64
diff --git a/container/kibana/build b/container/kibana/build index a7e4717..52d5a2a 100755 --- a/container/kibana/build +++ b/container/kibana/build @@ -3,4 +3,10 @@ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. # frozen_string_literal: true
-system 'docker build -t kibana:7.6.2 .' +BASE_IMAGE_DICT = {
- 'aarch64' => 'gagara/kibana-oss-arm64:7.6.2',
- 'x86_64' => 'kibana:7.6.2' }.freeze
+BASE_IMAGE = BASE_IMAGE_DICT[%x(arch).chomp]
Is 'arch' a shell command?
Thanks, Yuanchao
+system "docker build -t kibana:7.6.2 --build-arg BASE_IMAGE=#{BASE_IMAGE} ."
2.23.0