docker buildx构建多平台compose镜像 - Sun, Jun 28, 2020
docker buildx构建多平台compose镜像
1. 概述
由于单片机使用的是arm架构,但是官方的compose镜像不支持arm,所以需要自己构建compose镜像
2. 使用镜像安装docker-compose
2.1. 导入镜像
docker load -i csedge-compose-v1.25.0.tar
2.2. 复制脚本
cp docker-compose /usr/local/bin/
chmod +x /usr/local/bin/docker-compose
2.3. 测试
docker-compose -v
docker-compose version 1.25.0
3. 构建compose镜像
compose官方代码库
https://github.com/docker/compose
修改Dockerfile. 主要修改几点:
- alpine镜像源
RUN sed -e 's/dl-cdn[.]alpinelinux.org/mirrors.aliyun.com/g' -i~ /etc/apk/repositories
- debian镜像源
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
- pip镜像源
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- tox镜像源
[tox]
envlist = py37,pre-commit
indexserver =
default = https://pypi.tuna.tsinghua.edu.cn/simple
生成镜像
docker buildx build --platform=linux/arm64,linux/amd64,linux/arm --push -t csedge/compose:1.26.0 .