Skip to content

Commit

Permalink
nerdctl: update to v0.18.0; configure BuildKit with containerd worker
Browse files Browse the repository at this point in the history
BuildKit daemon is now configured to use containerd worker, not OCI worker

https://github.com/containerd/nerdctl/blob/v0.18.0/docs/build.md#setting-up-buildkit-with-containerd-worker

Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Mar 25, 2022
1 parent 3aca16d commit 9af6f98
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
19 changes: 17 additions & 2 deletions pkg/cidata/cidata.TEMPLATE.d/boot/40-install-containerd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,27 @@ fi

rm -rf "${tmp_extract_nerdctl}"

: "${CONTAINERD_NAMESPACE:=default}"
# Overridable in .bashrc
: "${CONTAINERD_SNAPSHOTTER:=overlayfs}"

if [ "${LIMA_CIDATA_CONTAINERD_SYSTEM}" = 1 ]; then
mkdir -p /etc/containerd
mkdir -p /etc/containerd /etc/buildkit
cat >"/etc/containerd/config.toml" <<EOF
version = 2
[proxy_plugins]
[proxy_plugins."stargz"]
type = "snapshot"
address = "/run/containerd-stargz-grpc/containerd-stargz-grpc.sock"
EOF
cat >"/etc/buildkit/buildkitd.toml" <<EOF
[worker.oci]
enabled = false
[worker.containerd]
enabled = true
namespace = "${CONTAINERD_NAMESPACE}"
snapshotter = "${CONTAINERD_SNAPSHOTTER}"
EOF
systemctl enable --now containerd buildkit stargz-snapshotter
fi
Expand Down Expand Up @@ -72,7 +85,9 @@ EOF
fi
sudo -iu "${LIMA_CIDATA_USER}" "XDG_RUNTIME_DIR=/run/user/${LIMA_CIDATA_UID}" systemctl --user enable --now dbus
sudo -iu "${LIMA_CIDATA_USER}" "XDG_RUNTIME_DIR=/run/user/${LIMA_CIDATA_UID}" "PATH=${PATH}" containerd-rootless-setuptool.sh install
sudo -iu "${LIMA_CIDATA_USER}" "XDG_RUNTIME_DIR=/run/user/${LIMA_CIDATA_UID}" "PATH=${PATH}" containerd-rootless-setuptool.sh install-buildkit
sudo -iu "${LIMA_CIDATA_USER}" "XDG_RUNTIME_DIR=/run/user/${LIMA_CIDATA_UID}" "PATH=${PATH}" \
"CONTAINERD_NAMESPACE=${CONTAINERD_NAMESPACE}" "CONTAINERD_SNAPSHOTTER=${CONTAINERD_SNAPSHOTTER}" \
containerd-rootless-setuptool.sh install-buildkit-containerd

# $CONTAINERD_SNAPSHOTTER is configured in 20-rootless-base.sh, when the guest kernel is < 5.13, or the instance was created with Lima < 0.9.0.
if [ "$(sudo -iu "${LIMA_CIDATA_USER}" sh -ec 'echo $CONTAINERD_SNAPSHOTTER')" = "fuse-overlayfs" ]; then
Expand Down
6 changes: 3 additions & 3 deletions pkg/limayaml/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ import (
)

func defaultContainerdArchives() []File {
const nerdctlVersion = "0.17.1"
const nerdctlVersion = "0.18.0"
location := func(goarch string) string {
return "https://github.com/containerd/nerdctl/releases/download/v" + nerdctlVersion + "/nerdctl-full-" + nerdctlVersion + "-linux-" + goarch + ".tar.gz"
}
return []File{
{
Location: location("amd64"),
Arch: X8664,
Digest: "sha256:046ac1c3d007b9b64880cb15a78ea1e0be345d31f51ff282be783a9c203f299d",
Digest: "sha256:62573b9e3bca6794502ad04ae77a2b12ec80aeaa21e8b9bbc5562f3e6348eb66",
},
{
Location: location("arm64"),
Arch: AARCH64,
Digest: "sha256:b773a0db178af9d0963b7c84df88ee434e0c1986fe7491dc1de3231e071e3921",
Digest: "sha256:6e3ca13479f0128e0ea3813bfba6a7ecc04707840f49ee248a64bfb2126bab4c",
},
}
}
Expand Down

0 comments on commit 9af6f98

Please sign in to comment.