moby: ERROR: failed to build resolver: passthrough: received empty target in Build()

Description

since I updated docker I get the above error whenever I try to run docker build

Reproduce

create an arbitrary Dockerfile run docker build . ERROR: failed to build resolver: passthrough: received empty target in Build()

Expected behavior

It should build the image

docker version

Client: Docker Engine - Community
 Version:           24.0.4
 API version:       1.43
 Go version:        go1.20.5
 Git commit:        3713ee1
 Built:             Fri Jul  7 14:50:57 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.4
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.5
  Git commit:       4ffc614
  Built:            Fri Jul  7 14:50:57 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    24.0.4
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.19.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 47
  Running: 6
  Paused: 0
  Stopped: 41
 Images: 14
 Server Version: 24.0.4
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
 Kernel Version: 5.15.0-78-generic
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 31.27GiB
 Name: russell-workstation
 ID: 14e2a789-c6d2-4a7e-92e2-293b93e0abe5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

running other commands (docker run etc) works

also running docker build with sudo works.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 5
  • Comments: 26 (11 by maintainers)

Most upvoted comments

I ran into the same error message. Adding the protocol otlp:// to the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT env var solved it for me.

I was having a similar problem, getting the exact same error message:

ERROR: failed to build resolver: passthrough: received empty target in Build()

After a lot of experimenting with sudo and environment variables I found that OTEL_EXPORTER_OTLP_ENDPOINT being set was the culprit (in my case). Unsetting it got rid of the error and docker build started working.

UPDATE I wanted to give an update regarding my issue so that you’re not looking into something that isn’t worth it.

I was doing all my tests in a specific repo folder and I was explicitly providing different kinds of environment files in the docker compose configuration.

However, I also had a .env env that contained config to be picked up from an other plugin I had and this had OTEL_EXPORTER_OTLP_ENDPOINT in it… I had simply forgotten the docker compose automatically picks up .env files…

As soon as I removed it, everything worked as expected

Sorry for the trouble!

Yes, I assume the default should work. But perhaps my assumption (compose setting a value) is incorrect; I asked in our internal slack if the compose team could have a peek if it’s possible related (or not).

I am having a quite similar issue.

Currently running Docker Desktop v.4.26.1 (131620) on Apple Silicon M2 Pro on MacOS: 14.2.1

While I can run docker build directly using a Dockerfile, if I try to use docker compose build to build the same Dockerfile, I get the same failed to build resolver: passthrough: received empty target in Build() error

The docker compose file is as simple as it gets:

services:
  web:
    build:
      dockerfile: ./build/Dockerfile-dev

The funny thing is that if I zero the OTEL variable the command works OTEL_EXPORTER_OTLP_ENDPOINT="" docker compose build

Please note that I do not have the OTEL_EXPORTER_OTLP_ENDPOINT set in my environment by default

Here is the output of the docker info

Client:
 Version:    24.0.7
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.0-desktop.2
    Path:     /Users/mitsos/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.23.3-desktop.2
    Path:     /Users/mitsos/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/mitsos/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.21
    Path:     /Users/mitsos/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  0.1
    Path:     /Users/mitsos/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.10
    Path:     /Users/mitsos/.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:     /Users/mitsos/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/mitsos/.docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.2.0
    Path:     /Users/mitsos/.docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 24.0.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc version: v1.1.10-0-g18a0cb0
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.5.11-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 10
 Total Memory: 7.663GiB
 Name: docker-desktop
 ID: a51f8f0f-fbb4-4731-b306-ec9c1f07b237
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: daemon is not using the default seccomp profile

@biffen unsetting that fixes it for me too. Thanks!