Building the Dockerfile executes with non-zero code 139

余生长醉 提交于 2020-05-14 05:54:13

问题


Description / Reproduction Steps

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.

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

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

Any suggestions on how to solve this problem?

Background Information

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.

EDIT:

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"

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


回答1:


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

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 .


来源:https://stackoverflow.com/questions/60562596/building-the-dockerfile-executes-with-non-zero-code-139

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!