docker打包 arm32v7/debian 问题总结

1.架构不同

我的宿主是x86 ,但是打包的是arm架构

安装qemu

sudo apt-get install binfmt-support qemu qemu-user-static

然后使用buildx打包

docker buildx build --no-cache --platform linux/arm/v7 -t tdc_post:1.0.1 . --load

保存tar

docker save -o tdc_post.tar tdc_post:1.0.0

2. 安装库报错

直接pip3 install -r requestments.txt 的时候报错

修改为执行apt-get install python3-xxx

python 复制代码
FROM arm32v7/debian AS build


# Run installs
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    apt-utils \
    python3 \
    python3-pip \
    python3-dev \
    python3-fastapi \
    python3-sqlalchemy

# pip install needed libraries with cert
RUN pip3 install requests --break-system-packages

RUN pip3 install pyyaml --break-system-packages
# Create a directory for the app
WORKDIR /app

# Copy the necessary Python files
COPY . .


# Set the entry point command
CMD ["python3", "start.py"]
相关推荐
.柒宇.4 小时前
AI掘金头条项目-K8s部署实战教程
python·云原生·容器·kubernetes·fastapi
杨浦老苏12 小时前
自托管网页EPUB阅读器Codexa
docker·群晖·电子书·calibre·opds
杨浦老苏12 小时前
开源文件协作平台OpenCloud
docker·文件管理·群晖·协作
weixin_3776348415 小时前
【MinerU】 Docker Compose 使用
docker·容器·mineru
孪生质数-15 小时前
Linux高危漏洞通报Copy Fail - CVE-2026-31431
linux·运维·服务器·ubuntu·网络安全·debian·cve-2026-31431
庚昀◟15 小时前
腾讯云 CVM + Docker + Jenkins + GitLab CI/CD 全流程指南(python、flask实现简单计算器)
python·ci/cd·docker·flask·jenkins
PH = 716 小时前
K8S集群的搭建
云原生·容器·kubernetes
SNOWPIAOP17 小时前
DOCKER的一些有用命令
docker
叶 落17 小时前
Ubuntu 通过 Docker 安装 Mysql8
linux·ubuntu·docker
赵文宇(温玉)17 小时前
Docker Compose 安装 Etcd
docker·容器·etcd