doujuan2688 2019-03-06 23:39
浏览 513

Docker-entrypoint.sh导致使用golang的ARM映像“未找到”

My problem is that I get an error when running my container on an ARM arch system(RaspberryPI with Raspbian). Image was built on that same Raspberry.

This is my dockerfile:

FROM arm32v7/golang

COPY qemu-arm-static /usr/bin

ENV STATUSOK_VERSION 0.1.1

RUN apt-get update \
    && apt-get install -y unzip \
    && wget https://github.com/sanathp/statusok/releases/download/$STATUSOK_VERSION/statusok_linux.zip \
    && unzip statusok_linux.zip \
    && mv ./statusok_linux/statusok /go/bin/StatusOk \
    && rm -rf ./statusok_linux* \
    && apt-get remove -y unzip git \
    && apt-get autoremove -y \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

VOLUME /config
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT /docker-entrypoint.sh

I'm able to succesfully build this on a RaspberryPI running Raspbian:

root@raspberrypi:~/armstatusok# docker build . -t armstatusok
Sending build context to Docker daemon  6.656kB
Step 1/7 : FROM arm32v7/golang
 ---> 8bbfdfd01a06
Step 2/7 : COPY qemu-arm-static /usr/bin
 ---> Using cache
 ---> 2572fd1e03a0
Step 3/7 : ENV STATUSOK_VERSION 0.1.1
 ---> Using cache
 ---> 25d39a4c6eb5
Step 4/7 : RUN apt-get update     && apt-get install -y unzip     && wget https://github.com/sanathp/statusok/releases/download/$STATUSOK_VERSION/statusok_linux.zip     && unzip statusok_linux.zip     && mv ./statusok_linux/statusok /go/bin/StatusOk     && rm -rf ./statusok_linux*     && apt-get remove -y unzip git     && apt-get autoremove -y     && apt-get clean     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Using cache
 ---> bfb1cfa9a985
Step 5/7 : VOLUME /config
 ---> Using cache
 ---> 3bfbce28329b
Step 6/7 : COPY ./docker-entrypoint.sh /docker-entrypoint.sh
 ---> Using cache
 ---> a1795ca4f40c
Step 7/7 : ENTRYPOINT /docker-entrypoint.sh
 ---> Using cache
 ---> d0ce74911ba3
Successfully built d0ce74911ba3
Successfully tagged armstatusok:latest

Next step is to run it, and where I get into trouble:

root@raspberrypi:~/armstatusok# docker run --name=armstatusok -v $PWD:/config armstatusok
/docker-entrypoint.sh: 1: /docker-entrypoint.sh: /go/bin/StatusOk: not found

I went into the container commenting line one of the docker-entrypoint.sh and checked if /go/bin/StatusOk was actually there, and it was.

My docker-entrypoint.sh:

root@raspberrypi:~/armstatusok# cat docker-entrypoint.sh
/go/bin/StatusOk --config /config/config.json

Now my question is, does anybody have a clue where to start? I also tested this dockerfile on x86 arch, and there it worked. I only changed the FROM line to the x86 flavour and removed the COPY qemu-arm-static /usr/bin since that line is there to make it work on ARM arch, according to documentation.

  • 写回答

1条回答 默认 最新

  • dongtang1997 2019-03-07 11:13
    关注

    I copied this Dockerfile and start script verbatim and it builds and runs perfectly for me. I get

    Config file not present at the given location: /config/config.json give correct file location using --config parameter

    because I don't have access to the config file you're using. But the fact I get that message means that StatusOk is running. So I don't know what to suggest.

    The only difference I made was to add a shebang #!/bin/sh to the start of the docker-entrypoint.sh file, and ensure it has execute permission, by running ls -al, and if it doesn't have x in the permissions, running chmod +rwx. Don't know if that made any difference as to how the script tried to access /go/bin/StatusOk.

    enter image description here

    Full docker-entrypoint.sh contents:

    #!/bin/sh
    /go/bin/StatusOk --config /config/config.json
    
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况