buildctl

一. 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

你可能感兴趣的:(images)