feat: builds support amd64+arm64
This commit is contained in:
@@ -7,7 +7,13 @@ K3S_VERSION=v1.28.2+k3s1
|
||||
|
||||
# K3s DinD Image Version
|
||||
# Built image version tag
|
||||
K3S_DIND_VERSION=0.2.1
|
||||
K3S_DIND_VERSION=0.2.2
|
||||
|
||||
# Multi-platform Build Support
|
||||
# This image supports building for multiple platforms: linux/amd64, linux/arm64
|
||||
# Build for current platform: docker compose build
|
||||
# Build multi-platform: docker buildx build --platform linux/amd64,linux/arm64 -t IMAGE_NAME --push .
|
||||
|
||||
# Preload Images
|
||||
# Whether to pre-download common images during build (true/false)
|
||||
# Set to false to speed up build time if you have good internet connectivity
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM docker:29-dind
|
||||
|
||||
ARG TARGETARCH=amd64
|
||||
ARG TARGETARCH
|
||||
ARG K3S_VERSION=v1.28.2+k3s1
|
||||
ARG PRELOAD_IMAGES="true"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ A lightweight Kubernetes distribution (K3s) running inside a Docker-in-Docker (D
|
||||
- ✅ Complete K3s cluster in a single container
|
||||
- ✅ Docker-in-Docker support for containerized workloads
|
||||
- ✅ Kubernetes API server exposed on port 6443
|
||||
- ✅ Multi-architecture support (x86-64, ARM64)
|
||||
- ✅ Multi-platform support (linux/amd64, linux/arm64)
|
||||
- ✅ Resource limits to prevent system exhaustion
|
||||
- ✅ Health checks for cluster readiness
|
||||
- ✅ Persistent storage for K3s and Docker data
|
||||
@@ -62,7 +62,7 @@ A lightweight Kubernetes distribution (K3s) running inside a Docker-in-Docker (D
|
||||
| Variable | Default | Description |
|
||||
| ----------------------------- | -------------- | ------------------------------------- |
|
||||
| `K3S_VERSION` | `v1.28.2+k3s1` | K3s version to install |
|
||||
| `K3S_DIND_VERSION` | `0.2.1` | Built image version tag |
|
||||
| `K3S_DIND_VERSION` | `0.2.2` | Built image version tag |
|
||||
| `PRELOAD_IMAGES` | `true` | Pre-download images during build |
|
||||
| `TZ` | `UTC` | Container timezone |
|
||||
| `K3S_API_PORT_OVERRIDE` | `6443` | Kubernetes API server port |
|
||||
@@ -166,6 +166,24 @@ Ensure the kubeconfig server address points to `localhost` or the correct IP:
|
||||
kubectl cluster-info
|
||||
```
|
||||
|
||||
## Building Multi-Platform Images
|
||||
|
||||
This image supports `linux/amd64` and `linux/arm64` platforms automatically.
|
||||
|
||||
```bash
|
||||
# Build for current platform
|
||||
docker compose build
|
||||
|
||||
# Build and push multi-platform image (requires Docker Buildx)
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
-t alexsuntop/k3s-inside-dind:0.2.2 --push .
|
||||
|
||||
# Customize K3s version
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
--build-arg K3S_VERSION=v1.29.0+k3s1 \
|
||||
-t myregistry/k3s-dind:1.0.0 --push .
|
||||
```
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Customize K3s Server Arguments
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- ✅ 在单个容器中运行完整的 K3s 集群
|
||||
- ✅ 支持 Docker-in-Docker,可运行容器化工作负载
|
||||
- ✅ 在 6443 端口暴露 Kubernetes API 服务器
|
||||
- ✅ 支持多架构(x86-64、ARM64)
|
||||
- ✅ 支持多平台(linux/amd64、linux/arm64)
|
||||
- ✅ 资源限制防止系统资源耗尽
|
||||
- ✅ 健康检查确保集群就绪
|
||||
- ✅ 持久化存储 K3s 和 Docker 数据
|
||||
@@ -62,7 +62,7 @@
|
||||
| 变量 | 默认值 | 说明 |
|
||||
| ----------------------------- | -------------- | ------------------------- |
|
||||
| `K3S_VERSION` | `v1.28.2+k3s1` | 要安装的 K3s 版本 |
|
||||
| `K3S_DIND_VERSION` | `0.2.1` | 构建的镜像版本标签 |
|
||||
| `K3S_DIND_VERSION` | `0.2.2` | 构建的镜像版本标签 |
|
||||
| `PRELOAD_IMAGES` | `true` | 构建时预下载镜像 |
|
||||
| `TZ` | `UTC` | 容器时区 |
|
||||
| `K3S_API_PORT_OVERRIDE` | `6443` | Kubernetes API 服务器端口 |
|
||||
@@ -166,6 +166,24 @@ docker compose logs -f k3s
|
||||
kubectl cluster-info
|
||||
```
|
||||
|
||||
## 构建多平台镜像
|
||||
|
||||
此镜像自动支持 `linux/amd64` 和 `linux/arm64` 平台。
|
||||
|
||||
```bash
|
||||
# 构建当前平台
|
||||
docker compose build
|
||||
|
||||
# 构建并推送多平台镜像(需要 Docker Buildx)
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
-t alexsuntop/k3s-inside-dind:0.2.2 --push .
|
||||
|
||||
# 自定义 K3s 版本
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
--build-arg K3S_VERSION=v1.29.0+k3s1 \
|
||||
-t myregistry/k3s-dind:1.0.0 --push .
|
||||
```
|
||||
|
||||
## 高级配置
|
||||
|
||||
### 自定义 K3s 服务器参数
|
||||
|
||||
@@ -13,10 +13,13 @@ x-defaults: &defaults
|
||||
services:
|
||||
k3s:
|
||||
<<: *defaults
|
||||
image: ${GLOBAL_REGISTRY:-}alexsuntop/k3s-inside-dind:${K3S_DIND_VERSION:-0.2.1}
|
||||
image: ${GLOBAL_REGISTRY:-}alexsuntop/k3s-inside-dind:${K3S_DIND_VERSION:-0.2.2}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
args:
|
||||
K3S_VERSION: ${K3S_VERSION:-v1.28.2+k3s1}
|
||||
PRELOAD_IMAGES: ${PRELOAD_IMAGES:-true}
|
||||
|
||||
Reference in New Issue
Block a user