fussybeaver / bollard

Docker daemon API in Rust
Apache License 2.0
911 stars 134 forks source link

code is inactive due to #[cfg] directives: feature = "buildkit" is disabled #389

Open GreyCode3 opened 8 months ago

GreyCode3 commented 8 months ago

I follow /example/build_buildkit.rs with bollard = { version = "0.16.0", features = ["buildkit"] }, but #[cfg(feature = "buildkit")] statement shows error: code is inactive due to #[cfg] directives: feature = "buildkit" is disabled. If I remove #[cfg(feature = "buildkit")], StatusResponse prompt error: "no active session for go: context deadline exceeded". Any steps I setup wrongly?

fussybeaver commented 8 months ago

Thanks for the report. Can you write the output of docker info and the contents of the dockerd configuration in /etc/docker/daemon.json .

It should contain:

{
    "features": {
        "buildkit": true
    }
}
GreyCode3 commented 8 months ago

I tried, but nothing inside the location /etc/docker/ or ~/.config/docker/, I'm not sure it relates to rootless-mode or not. And the docker info is below:

Client: Docker Engine - Community
 Version:    25.0.4
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1-desktop.4
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.3-desktop.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container. (Docker Inc.)
    Version:  0.0.22
    Path:     /usr/lib/docker/cli-plugins/docker-debug
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /usr/lib/docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.21
    Path:     /usr/lib/docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.4
    Path:     /usr/lib/docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.0.0
    Path:     /usr/lib/docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /usr/lib/docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.3.0
    Path:     /usr/lib/docker/cli-plugins/docker-scout

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 2
 Server Version: 25.0.4
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: false
  userxattr: true
 Logging Driver: json-file
 Cgroup Driver: none
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  rootless
 Kernel Version: 5.15.0-100-generic
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.35GiB
 Name: XXX
 ID: XXXXXXXXXXXXXXXXXXXXXXXXXX
 Docker Root Dir: /home/XXX/.local/share/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  192.168.0.114:5000
  192.168.0.202:5000
  127.0.0.0/8
 Live Restore Enabled: false
GreyCode3 commented 8 months ago

After some research, I gusess I need to install RootlessKit first to enable buildkit under rootless mode then everything will be okay... I'am trying now, will report this later.

GreyCode3 commented 8 months ago

Sorry, I didn't work out how to enable buildkit in rootless mode, so I just put dockerfile inside a tarball to build it.