Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config option is not working with containerd #5757

Open
4 tasks done
gerijani opened this issue Feb 18, 2025 · 2 comments
Open
4 tasks done

Config option is not working with containerd #5757

gerijani opened this issue Feb 18, 2025 · 2 comments

Comments

@gerijani
Copy link

Contributing guidelines and issue reporting guide

Well-formed report checklist

  • I have found a bug that the documentation does not mention anything about my problem
  • I have found a bug that there are no open or closed issues that are related to my problem
  • I have provided version/information about my environment and done my best to provide a reproducer

Description of bug

Bug description

Setting a specific namespace for buildkit to be work in has no affect:

[worker.containerd]
   namespace = "default"

After restarting containerd service recreates the buildkit ns:

>nerdctl namespace ls:

NAME        CONTAINERS    IMAGES    VOLUMES    LABELS
buildkit    0             0         0 <-------newly created
default     0             0         0

Reproduction

On Ubuntu 24.04 LTS deploy containerd from a default repo:
containerd/noble-updates,now 1.7.24-0ubuntu1~24.04.1

Install buildkit from tar.gz https://github.com/moby/buildkit/releases/download/v0.19.0/buildkit-v0.19.0.linux-amd64.tar.gz
Using examples from https://github.com/moby/buildkit/tree/13c7eaaf858b82b733339e362e89be5c8d5658f5/examples/systemd/system to run it as systemd service.

Restarting service always recreates namespace as in systemd service status shows at "==>":

❯ sudo systemctl status buildkit.service
● buildkit.service - BuildKit
     Loaded: loaded (/etc/systemd/system/buildkit.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-02-18 16:48:33 CET; 14min ago
TriggeredBy: ● buildkit.socket
       Docs: https://github.com/moby/buildkit
   Main PID: 3243 (buildkitd)
      Tasks: 10 (limit: 19039)
     Memory: 11.1M ()
     CGroup: /system.slice/buildkit.service
             └─3243 /opt/containerd/bin/buildkitd --oci-worker-snapshotter=stargz

Feb 18 16:48:33 Lenovo-15411 systemd[1]: Starting buildkit.service - BuildKit...
Feb 18 16:48:33 Lenovo-15411 buildkitd[3243]: time="2025-02-18T16:48:33+01:00" level=warning msg="using host network as the default"
Feb 18 16:48:33 Lenovo-15411 buildkitd[3243]: time="2025-02-18T16:48:33+01:00" level=info msg="found worker \"d60hrjule1t19212upz7e754r\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproje......>
Feb 18 16:48:33 Lenovo-15411 buildkitd[3243]: time="2025-02-18T16:48:33+01:00" level=warning msg="using host network as the default"
Feb 18 16:48:33 Lenovo-15411 buildkitd[3243]: time="2025-02-18T16:48:33+01:00" level=info msg="found worker \"qdhl3ohp0yaf2f0irlefbz64d\", 
==>
 labels=map[org.mobyproject.buildkit.worker.containerd.namespace:buildkit.......>

Feb 18 16:48:33 Lenovo-15411 buildkitd[3243]: time="2025-02-18T16:48:33+01:00" level=info msg="found 2 workers, default=\"d60hrjule1t19212upz7e754r\""
Feb 18 16:48:33 Lenovo-15411 buildkitd[3243]: time="2025-02-18T16:48:33+01:00" level=warning msg="currently, only the default worker can be used."
Feb 18 16:48:33 Lenovo-15411 buildkitd[3243]: time="2025-02-18T16:48:33+01:00" level=info msg="running server on /run/buildkit/buildkitd.sock"
Feb 18 16:48:33 Lenovo-15411 systemd[1]: Started buildkit.service - BuildKit
@AkihiroSuda
Copy link
Member

The config path might be incorrect?

The file path is `/etc/buildkit/buildkitd.toml` for rootful mode,
`~/.config/buildkit/buildkitd.toml` for rootless mode.

@gerijani
Copy link
Author

The config path might be incorrect?

buildkit/docs/buildkitd.toml.md

Lines 9 to 10 in 4712052

The file path is /etc/buildkit/buildkitd.toml for rootful mode,
~/.config/buildkit/buildkitd.toml for rootless mode.

Nope. It's ok.

❯ sudo ls -l /etc/buildkit/buildkitd.toml
-rw-r--r-- 1 root root 804 Feb 19 17:21 /etc/buildkit/buildkitd.toml
❯ sudo cat /etc/buildkit/buildkitd.toml
# root is where all buildkit state is stored.
root = "/var/lib/buildkit"
# insecure-entitlements allows insecure entitlements, disabled by default.
insecure-entitlements = [ "network.host", "security.insecure" ]

[log]
  # log formatter: json or text
  format = "text"

[worker.containerd]
  address = "/run/containerd/containerd.sock"
  enabled = true
  platforms = [ "linux/amd64", "linux/arm64" ]
  namespace = "default"

[worker.containerd.runtime]
  name = "io.containerd.runc.v2"
  path = "/usr/bin/runc"
  options = { BinaryName = "runc" }

[[worker.containerd.gcpolicy]]
    reservedSpace = 512000000
    keepDuration = 172800
    filters = [ "type==source.local", "type==exec.cachemount", "type==source.git.checkout"]
[[worker.containerd.gcpolicy]]
    all = true
    reservedSpace = 1024000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants