0
点赞
收藏
分享

微信扫一扫

【docker】Mac M1 构建 x64 linux镜像

亲测教程,跨平台镜像构建

[toc]

首先

首先你需要有一个 Dockerfile

比如:这里以一个 python 项目举例

FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "bin/run.py" ]

【docker】Mac M1 构建 x64 linux镜像_上传

构建环境

前置环境设置,创建了一个 mybuilder 环境,

docker buildx create --name mybuilder --bootstrap --use

查看支持的环境

docker buildx ls

【docker】Mac M1 构建 x64 linux镜像_bash_02

上传镜像的你的 repo,这里举例上传到 阿里云的 repo:

编译打包上传

docker buildx build --platform linux/amd64 --tag registry.cn-beijing.aliyuncs.com/xxx/xxx:heloworldjavapub --push  .

举报

相关推荐

0 条评论