构建 Dockerfile 使用非零代码执行 139 [英] Building the Dockerfile executes with non-zero code 139

查看:67
本文介绍了构建 Dockerfile 使用非零代码执行 139的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 opc-ua 服务器示例server_ctt"(使用来自 此处的 open62541 库) 在我的 Raspberry Pi 1 上的 docker 容器中,但是我无法创建 docker 映像.

I am trying to run the opc-ua server examle "server_ctt" (using the open62541 library from here) within a docker container on my Raspberry Pi 1, but I am failing at creating the docker image.

我按照此处上的说明进行操作,并首先克隆了该存储库.之后,我尝试通过在 open62541 目录中执行以下命令来构建映像:docker build -f docker/Dockerfile .

I followed the instructions on here and cloned the repo at first. Afterwards, I try to build the image by executing the following command in the open62541 directory: docker build -f docker/Dockerfile .

这是我在终端中得到的输出:

This is the output I am getting in the terminal:

pi@raspberrypi:~/ma/dockerVersion/open62541 $ docker build -f docker/Dockerfile                         .
Sending build context to Docker daemon  38.69MB
Step 1/18 : FROM alpine:3.10
3.10: Pulling from library/alpine
4e972d957a60: Pull complete
Digest: sha256:7c3773f7bcc969f03f8f653910001d99a9d324b4b9caa008846ad2c3089f5a5f
Status: Downloaded newer image for alpine:3.10
 ---> cf7ea1e5a972
Step 2/18 : RUN apk add --no-cache cmake gcc git g++ musl-dev mbedtls-dev python py-pip make && rm -rf /var/cache/apk/*
 ---> Running in 82c8b5868509
The command '/bin/sh -c apk add --no-cache cmake gcc git g++ musl-dev mbedtls-dev python py-pip make && rm -rf /var/cache/apk/*' returned a non-zero code: 139

事先,我已经使用便利脚本 此处在我的 raspberry pi 上安装了 docker.一个>

Beforehand, I have installed docker on my raspberry pi using the convenience script here

关于如何解决这个问题有什么建议吗?

Any suggestions on how to solve this problem?

我通过 PuTTy 连接到我的树莓派.但我想这并没有什么区别.此外,在 Windows 上构建映像并运行 server_ctt 示例完全正常.

I am connected to my raspberry pi via PuTTy. But I guess this doesn't make the difference. Furthermore, building the image on Windows and running the server_ctt example works completely fine.

在我的 windows pc 上构建/运行 open62541 图像时,我尝试将其保存并将其复制到我的树莓派 1.树莓派上的 docker load 命令工作正常,在错误之后运行图像输出:

As building/running the open62541 image is working on my windows pc, I have tried to save and copy it to my raspberry pi 1. The docker load command on my raspberry pi was working just fine put running the images outputs following erro:

standard_init_linux.go:211: exec user process caused "exec format error"

这可能是由于架构不同(因为树莓派 1 使用 ARM 架构).我该如何解决这个问题?

This may be due to different architectures (as raspberry pi 1 uses the ARM architecture). How can I solve this?

推荐答案

回答更新的问题:您可以使用 实验性docker buildx 命令.

To answer the updated question: You can build for your Raspberry Pi with the experimental docker buildx command.

这将创建一些虚拟化构建器,用于为所需架构构建容器.因此,构建过程可能需要更长的时间(我认为 10 倍对我的项目来说是现实的).

This will create some virtualized builders that will build your container for the desired architectures. As such, the build process can take much longer (I think a factor of 10 is realistic for my projects).

对于您的案例来说,最重要的命令类似于

The most important command for your case would be something like

docker buildx build --platform linux/arm/v7 .

这篇关于构建 Dockerfile 使用非零代码执行 139的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆