简体   繁体   中英

Docker Error: standard_init_linux.go:195: exec user process caused “exec format error”

I am trying to build docker image for scigraph, the image is getting built successfully but when I try to run I'm getting following error

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

I am copying already compiled scigraph, and copying the binary version to docker

My Docker file is here

FROM ubuntu:14.04
# Set locales
RUN locale-gen en_GB.UTF-8
ENV LANG en_GB.UTF-8
ENV LC_CTYPE en_GB.UTF-8

RUN apt-get update && \
apt-get install -y git build-essential curl wget software-properties-common

#Reference 2:http://help.jabref.org/en/Installation
RUN \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer wget unzip tar && \
sudo apt install oracle-java8-set-default
# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV MAVEN_VERSION 3.5.2

RUN mkdir -p /usr/share/maven \
  && curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
    | tar -xzC /usr/share/maven --strip-components=1 \
  && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven

VOLUME /root/.m2

RUN ["mvn", "-version"]

ADD ./SciGraph /usr/share/SciGraph
WORKDIR /usr/share/SciGraph/SciGraph-services
RUN pwd
RUN cat run.sh
RUN chmod +x run.sh
EXPOSE 9000
CMD ["./run.sh"]

When I run docker inspect on the image built, I got below result

[
    {
        "Id": "sha256:335ca1855f158838ec48b04e50b5f9a5d9160549ff70909fdfe1128917158775",
        "RepoTags": [
            "terminology-server:latest"
        ],
        "RepoDigests": [],
        "Parent": "sha256:7444c6c6a2443b1602e3ae69786658d90f7c23124245b2e935b41e8bce9356c6",
        "Comment": "",
        "Created": "2018-03-16T06:06:24.834821577Z",
        "Container": "e1e8e7a22b8c492aa9ad03b066f8b96a587c3e3b8ffa95999eb9ed9779f67b73",
        "ContainerConfig": {
            "Hostname": "e1e8e7a22b8c",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "9000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=en_GB.UTF-8",
                "LC_CTYPE=en_GB.UTF-8",
                "JAVA_HOME=/usr/lib/jvm/java-8-oracle",
                "MAVEN_VERSION=3.5.2",
                "MAVEN_HOME=/usr/share/maven"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "ENTRYPOINT [\"./run.sh\"]"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:7444c6c6a2443b1602e3ae69786658d90f7c23124245b2e935b41e8bce9356c6",
            "Volumes": {
                "/root/.m2": {}
            },
            "WorkingDir": "/usr/share/SciGraph/SciGraph-services",
            "Entrypoint": [
                "./run.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "DockerVersion": "17.11.0-ce",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "9000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=en_GB.UTF-8",
                "LC_CTYPE=en_GB.UTF-8",
                "JAVA_HOME=/usr/lib/jvm/java-8-oracle",
                "MAVEN_VERSION=3.5.2",
                "MAVEN_HOME=/usr/share/maven"
            ],
            "Cmd": null,
            "ArgsEscaped": true,
            "Image": "sha256:7444c6c6a2443b1602e3ae69786658d90f7c23124245b2e935b41e8bce9356c6",
            "Volumes": {
                "/root/.m2": {}
            },
            "WorkingDir": "/usr/share/SciGraph/SciGraph-services",
            "Entrypoint": [
                "./run.sh"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 6006850073,
        "VirtualSize": 6006850073,
        "GraphDriver": {
            "Data": {
                "DeviceId": "119",
                "DeviceName": "docker-253:0-135982681-1702cffe2f92ce39cbf75bfcea05a2ee40eadc2f80b962fc210ec27e96e56462",
                "DeviceSize": "10737418240"
            },
            "Name": "devicemapper"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:92fb50b4d953c72eb1d5c045bab47a78f5c02348d8f004f7229a7b8fef16608d",
                "sha256:e95051d9cb9b95bf46df6cf5affab21157019659b3405e9c69f1f4a8376b24e7",
                "sha256:3abb69fb15dc83c0bf7a562f7bda73844fd20ed8cc4aec7b28ebd4113797cd9a",
                "sha256:dd420adea0d3f9f9da8500d4a8ec542ae0a32e78de557c9ce3755bd416431b5a",
                "sha256:65262d4f5516e81457c1ad5e14da8fbf66a999557107bbc7c2a635cbf94e64d9",
                "sha256:03e3aec56bc75b44ee8325903551663804e6796168a21393ca59acc95585f7fb",
                "sha256:3053ff98dd241a19da60a0dcfb17ddae6295ec8f0f1eb5f12cb3c30a38f8bc51",
                "sha256:9f4d23d434f7f98108c72aa95685641bf9174892afd5a5b381ab44fb9633cbe2",
                "sha256:d2e5c48f386cfb9c9f2a7b617c4b47b57d4f173d5ebdf8cabbb25be376f15e75",
                "sha256:c648b941988def7315a0c2a7c6ef48fcf611d468cab391e2aa3850561c34c806",
                "sha256:cd3923aee93d75b13d1d2e87de5feb671dc3fc81a13899c2c64377c5b997e6ff",
                "sha256:e03445efaadc5bbdb8641ff433afa91d56f5ac54e21b255c679c6bbb1ea1b0c7"
            ]
        },
        "Metadata": {
            "LastTagTime": "2018-03-16T01:07:03.881388924-05:00"
        }
    }
]

Check what is the ENTRYPOINT by inspecting your image.

If it is a standard sh -c , a CMD ./run.sh should be enough.
But if it is not, ./run.sh might not be compatible with ENTRYPOINT command.


ADD ./SciGraph /usr/share/SciGraph

That will copy an executable SciGraph to your Ubuntu image.
If that executable was not compiled for that Ubuntu 64bits platform, that would generate an "exec format error" at runtime.
That is why Go crosscompilation is important.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM