使用qemu在x86上为Arm设备构建映像。一旦我的Dockerfile开始安装setuptools,它就会出错。输出如下:
Step 13/23 : RUN pip3 install --upgrade setuptools
---> Running in 033acd7ab5bb
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/b2/86/095d2f7829badc207c893dd4ac767e871f6cd547145df797ea26baea4e2e/setuptools-41.2.0-py2.py3-none-any.whl (576kB)
Installing collected packages: setuptools
Found existing installation: setuptools 40.6.2
Uninstalling setuptools-40.6.2:
ERROR: Could not install packages due to an EnvironmentError: [('/usr/lib/python3.6/site-packages/__pycache__/easy_install.cpython-36.pyc', '/usr/lib/python3.6/site-packages/~_pycache__/easy_install.cpython-36.pyc', "[Errno 38] Function not implemented: '/usr/lib/python3.6/site-packages/__pycache__/easy_install.cpython-36.pyc'"), ('/usr/lib/python3.6/site-packages/__pycache__/', '/usr/lib/python3.6/site-packages/~_pycache__', "[Errno 38] Function not implemented: '/usr/lib/python3.6/site-packages/__pycache__/'")]
ERROR: Service 'lo3-reader-test' failed to build: The command '/bin/sh -c pip3 install --upgrade setuptools' returned a non-zero code: 1
还有我的Dockerfile(ARCH_IMAGE == arm64v8 / alpine:3.9):
#Main Container for reader
FROM $ARCH_IMAGE AS production
ENV SIMULATION False
ENV HEARTBEAT_FILE_PATH=/var/run/heartbeat
WORKDIR /app
ADD . /app
COPY qemu-aarch64-static /usr/bin/
VOLUME /var/run/lo3energy /data/lo3energy
RUN apk --update add --no-cache python3
RUN apk --update add --no-cache bash
RUN python3 -m ensurepip
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
RUN pip3 install --upgrade wheel
RUN pip3 install --upgrade ekmmeters minimalmodbus
CMD ["python3", "-u", "lo3_reader.py"]
HEALTHCHECK --interval=30s --timeout=10s CMD bin/docker_healthcheck
#########################################
# Testing Container
FROM production AS test
ARG VERSION=unspecified
LABEL maintainer="lo3energy <developers@lo3energy.com>" version="${VERSION}-test"
WORKDIR /app
RUN pip3 install pytest pyserial minimalmodbus
CMD [ "python3", "-m", "pytest" ]
任何想法表示赞赏!