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"]
相关推荐
心理之旅3 小时前
高校文献检索系统
运维·服务器·容器
大佐不会说日语~4 小时前
使用Docker Compose 部署时网络冲突问题排查与解决
运维·网络·spring boot·docker·容器
小徐敲java6 小时前
(运维)1Panel服务器面板Docker部署
运维·服务器·docker
曾几何时`7 小时前
Docker容器化部署编译运行模块
运维·docker·容器
直饮水观察哨9 小时前
商用净水器亲测对比,哪个更专业?
容器
Suchadar10 小时前
Docker基础命令(二)——数据卷管理端口映射与容器互联
运维·docker·容器
firstacui10 小时前
Docker容器网络管理与容器数据卷管理
运维·docker·容器
codeRichLife11 小时前
docker拷贝,导入/导出等常用命令
docker
努力搬砖的咸鱼12 小时前
部署你的第一个应用到 K8s
微服务·云原生·容器·kubernetes
lpruoyu13 小时前
【Docker进阶-01】Docker隔离原理与可视化界面-Portainer
docker