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"]
相关推荐
魏 无羡24 分钟前
k8s ssl 漏洞修复
容器·kubernetes·ssl
hjnjmjkj1 小时前
基于windows的docker-desktop安装kubenetes以及dashboard
docker·容器·kubernetes
Libby博仙1 小时前
docker 改了镜像源为阿里云,还是下载失败
阿里云·docker·容器
百锦再2 小时前
在Linux上创建一个Docker容器并在其中执行Python脚本
linux·python·docker
钗头风2 小时前
3.Docker常用命令
运维·docker·容器
圣心5 小时前
Ollama Docker 镜像部署
运维·docker·容器
Karoku0665 小时前
【CI/CD】Jenkinsfile管理+参数化构建+邮件通知以及Jenkins + SonarQube 代码审查
运维·ci/cd·容器·kubernetes·jenkins·rancher
转身後 默落5 小时前
06.Docker 镜像制作和管理
java·docker·容器
明明跟你说过7 小时前
【Kubernetes】常用命令全解析:从入门到实战(下)
运维·云原生·容器·kubernetes·k8s
Christal_pyy11 小时前
树莓派4基于Debian GNU/Linux 12 (Bookworm)添加多个静态ipv4网络
linux·网络·debian