共计 841 个字符,预计需要花费 3 分钟才能阅读完成。
一. buildctl
- 因为应用 containerd,而 ctr 没有构建镜像的性能,应用
buildkit
可代替
参考一
buildkit 装置
https://github.com/moby/buildkit/releases
cp buildkitd /usr/local/bin/
cp buildctl /usr/local/bin/
# 须要启动 buildkitd,故作为 system 启动
vim /lib/systemd/system/buildkitd.service
[Unit]
Description=/usr/local/bin/buildkitd
ConditionPathExists=/usr/local/bin/buildkitd
After=containerd.service
[Service]
Type=simple
ExecStart=/usr/local/bin/buildkitd
User=root
Restart=on-failure
RestartSec=1500ms
[Install]
WantedBy=multi-user.target
# 能够选多种 type 类型
buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. -output type=docker,name=sughoot:v1beta2 | docker load
buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. -output type=image,name=sughoot:v1beta2,push=true
buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. -output type=tar,name=sughoot:v1beta2,dest=out.tar
正文完