Docker: Error response from daemon: rpc error: code = 2 desc = "oci runtime error: exec format error"
Asked Answered
A

3

18

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 .

The output of this command was

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

I get an error

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

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
Ambroseambrosi answered 15/4, 2016 at 17:33 Comment(5)
For starters, I think you may be confusing CMD and RUN.Indolence
Two errors in your Dockerfile: CMD should be RUN, and EXPOSE should not contain the mapping (just the port)Dugan
I made the changes you guys suggested... but still the same problem. I updated my code above. Please have a look at updated code.Ambroseambrosi
Also, one single EXPOSE command that combines all the ports would be enough.Effect
tried it. but still same error. updated my code above.Ambroseambrosi
T
30

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
Testudinal answered 16/4, 2016 at 21:40 Comment(3)
I was getting this error and I fixed just by looking at your example. My shebang was wrong, #/bin/bash.Axes
Just a comment on that - it also happens with Kubernetes and Readiness Probes. Remember about those crazy shebangs!Jeramie
Or also is possible change entry point to: ENTRYPOINT ["bash -c /entrypoint.sh"]. Same solution in other way.Bonner
I
2

Error response from daemon: rpc error: code = 2 desc = “oci runtime error: exec format error”

In my case I got this error when trying to install docker on a 32bit ArchLinux (a raspberry pi 2). Instead I used HyperioOS and it went alot smoother and was so much faster to install. But in the end, most docker images are not compatible with 32 bit architectures and they outline this as a possible reason to get this error.

Here we run Docker on a Raspberry Pi. So the CPU architecture here is ARM rather than x86/x64 by Intel or AMD. Thus, Docker-based apps you use have to be packaged specifically for ARM architecture! Docker-based apps packaged for x86/x64 will not work and will result in an error

Implode answered 4/8, 2016 at 5:40 Comment(2)
I tried Hyperio, and I am still getting the aforementioned error.Succussion
You're right. Hyperiot doesn't solve the error if you are using a docker image built for x86 chip architecture. In the end I gave up because for anything to run on the ARM chipset, it needs to be compiled on an ARM chip. That means the entire container, all the way down to the base image needs to be built specifically. And most containers are not built for ARMImplode
A
0

According to Cloudera's documentation you should start it with --hostname and --priviliged

From the docs

docker run --hostname=quickstart.cloudera --privileged=true -t -i [OPTIONS] [IMAGE] /usr/bin/docker-quickstart

Explanation for required flags and other options are in the following table:

--hostname=quickstart.cloudera    Required: pseudo-distributed configuration assumes this hostname
--privileged=true                 Required: for HBase, MySQL-backed Hive metastore, Hue, Oozie, Sentry, and Cloudera Manager, and possibly others
-t                                Required: once services are started, a Bash shell takes over and will die without this
-i                                Required: if you want to use the terminal, either immediately or attach later
-p 8888                           Recommended: maps the Hue port in the guest to another port on the host
-p [PORT]                         Optional: map any other ports (e.g. 7180 for Cloudera Manager, 80 for a guided tutorial)
-d                                Optional: runs the container in the background
Adermin answered 15/4, 2016 at 18:36 Comment(1)
done that (and updated code above) but still same errorAmbroseambrosi

© 2022 - 2024 — McMap. All rights reserved.