background
An error is reported when an executable file packaged by a project is executed in the alpine container
Solution:
It is judged that the lack of dependent environment leads to the unrecognization of this executable file. Install glibc to solve the problem
You can also directly change the from image to busybox: glibc
cat Dockerfile
FROM alpine:3.14
COPY xxx /tmp/
ARG TZ="Asia/Shanghai"
ENV TZ ${TZ}
RUN mkdir -p /opt/xxx && mv /tmp/xxx /tmp/ysera_mgtv.conf /opt/xxx && \
chmod 777 /opt/xxx/xxx && \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk add tzdata && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk && \
apk add glibc-2.29-r0.apk
USER root
CMD ["/opt/xxx/xxx"]