【发布时间】:2021-04-23 22:22:32
【问题描述】:
运行我通过 Dockerfile 中的 RUN 部分安装的工具时,我收到以下错误:
root@3a583c845e0f:/code# ./trec_eval-9.0.7/trec_eval
bash: ./trec_eval-9.0.7/trec_eval: cannot execute binary file: Exec format error
当我make Dockerfile 中的一个工具时,我看到数据类型不同:
root@4fc24a0ff259:/code# file trec_eval-9.0.7/trec_eval
trec_eval-9.0.7/trec_eval: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
当我make创建容器内的工具时:
root@4fc24a0ff259:/code# file trec_eval-9.0.7/trec_eval
ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=b3f7494afc9a0ec7b634583a2f4401f62d716ec9, with debug_info, not stripped
在容器内制作工具后,它工作正常。
Dockerfile
FROM python:3.8-slim
# Create work directory.
WORKDIR /code
# Copy files (unnecessary files excluded via .dockerignore).
COPY . .
# Install requirements.
RUN pip install -r requirements.txt
# Download and make trec_eval.
RUN apt-get update && \
apt-get install wget -y && \
apt-get install build-essential -y && \
wget https://github.com/usnistgov/trec_eval/releases/download/v9.0.7/trec_eval-9.0.7.tar.gz && \
tar -zxf trec_eval-9.0.7.tar.gz && \
cd trec_eval-9.0.7 && make && cd ..
# Expose port.
EXPOSE 8050
# Start app.
CMD [ "python", "./run-comparator/app.py" ]
如何解释这种行为?
【问题讨论】:
标签: docker format dockerfile exec