本文介绍了Docker:来自守护进程的错误响应:rpc 错误:代码 = 2 desc =“oci 运行时错误:exec 格式错误"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了以下 docker 文件

I wrote the following docker file

FROM cloudera/quickstart

MAINTAINER abhishek "http://www.foobar.com"

ADD ./SparkIntegrationTestsAssembly.jar /
ADD ./entrypoint.sh /
ADD ./twitter.avro /

EXPOSE 8020 50070 50010 50020 50075 8030 8031 8032 8033 8088 8040 8042 10020 19888 11000 8888 18080 7077

RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

我使用命令构建了我的图像

i built my image using the command

docker build --tag foobar:auto .

这个命令的输出是

Sending build context to Docker daemon  93.1 MB
Step 1 : FROM cloudera/quickstart
 ---> 4239cd2958c6
Step 2 : MAINTAINER abhishek "http://www.foobar.com"
 ---> Running in 3ad11fe4aa77
 ---> 22a2f2840475
Removing intermediate container 3ad11fe4aa77
Step 3 : ADD ./SparkIntegrationTestsAssembly.jar /
 ---> 1ebae604e632
Removing intermediate container 0f047ec885a8
Step 4 : ADD ./entrypoint.sh /
 ---> 880cf4ff22aa
Removing intermediate container 0808ba44c97a
Step 5 : ADD ./twitter.avro /
 ---> 6978f2adf422
Removing intermediate container 43d812aaa3ae
Step 6 : EXPOSE 8020 50070 50010 50020 50075 8030 8031 8032 8033 8088 8040 8042 10020 19888 11000 8888 18080 7077
 ---> Running in af90e145f295
 ---> 6fcfb5ad934c
Removing intermediate container af90e145f295
Step 7 : RUN chmod +x /entrypoint.sh
 ---> Running in 4696faa2d330
 ---> 843ee5165937
Removing intermediate container 4696faa2d330
Step 8 : ENTRYPOINT /entrypoint.sh
 ---> Running in 4caf6e225007
 ---> 81cca7ee3198
Removing intermediate container 4caf6e225007
Successfully built 81cca7ee3198

但是当我尝试使用运行我的容器时

But when i try to run my container using

docker run --hostname=quickstart.cloudera --rm --privileged=true -t -i  -p "8020:8020" -p "50070:50070" -p "50010:50010" -p "50020:50020" -p "50075:50075" -p "8030:8030" -p "8031:8031" -p "8032:8032" -p "8033:8033" -p "8088:8088" -p "8040:8040" -p "8042:8042" -p "10020:10020" -p "19888:19888" -p "11000:11000" -p "8888:8888" -p "18080:18080" -p "7077:7077" foobar:auto

我收到一个错误

docker: Error response from daemon: rpc error: code = 2 desc = "oci runtime error: exec format error".

我的 entrypoint.sh 文件看起来像

My entrypoint.sh file looks like

/usr/bin/docker-quickstart
service hadoop-hdfs-namenode restart
hdfs dfs -mkdir -p input
hdfs dfs -put /twitter.avro /input/twitter.avro
spark-submit --class com.abhi.HelloWorld --master local[1] SparkIntegrationTestsAssembly.jar /input/twitter.avro /output

推荐答案

您是否发布了完整的 entrypoint.sh?内核尝试通过查看可执行文件的第一个字节来识别文件类型.对于脚本,您需要添加所谓的 shebang 行.您可能需要在 entrypoint.sh 的最顶部添加一个 shebang 行,例如:

Did you post your complete entrypoint.sh?The kernel tries to recognize the file type by looking at the first bytes of the executable. For scripts you need to add a so-called shebang line. You might need to add a shebang line at the very top of your entrypoint.sh, e.g.:

#!/bin/sh
/usr/bin/docker-quickstart
service hadoop-hdfs-namenode restart
hdfs dfs -mkdir -p input
hdfs dfs -put /twitter.avro /input/twitter.avro
spark-submit --class com.abhi.HelloWorld --master local[1] SparkIntegrationTestsAssembly.jar /input/twitter.avro /output

这篇关于Docker:来自守护进程的错误响应:rpc 错误:代码 = 2 desc =“oci 运行时错误:exec 格式错误"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 22:26