unable to evaluate symlinks in Dockerfile path: lstat /drone/src/Dockerfile: no such file or directory

latest: Pulling from plugins/docker
Digest: sha256:aa77225fd5f1e2353e60d4344a5f4cd359a69d301d1cf0516f6441f0044bc586
Status: Image is up to date for plugins/docker:latest
+ /usr/local/bin/dockerd --data-root /var/lib/docker --insecure-registry git.xxx.com:5050
time="2020-05-15T02:45:30.390169323Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
time="2020-05-15T02:45:30.391325431Z" level=info msg="libcontainerd: started new containerd process" pid=32
time="2020-05-15T02:45:30.391374824Z" level=info msg="parsed scheme: \"unix\"" module=grpc
time="2020-05-15T02:45:30.391389514Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2020-05-15T02:45:30.391475533Z" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}]" module=grpc
time="2020-05-15T02:45:30.391498958Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2020-05-15T02:45:30.391583043Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc4208eb390, CONNECTING" module=grpc
time="2020-05-15T02:45:30Z" level=info msg="starting containerd" revision=468a545b9edcd5932818eb9de8e72413e616e86e version=v1.1.2 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.content.v1.content"..." type=io.containerd.content.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.btrfs"..." type=io.containerd.snapshotter.v1 
time="2020-05-15T02:45:30Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.btrfs" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.aufs"..." type=io.containerd.snapshotter.v1 
time="2020-05-15T02:45:30Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.aufs" error="modprobe aufs failed: "ip: can't find device 'aufs'\naufs                  217088  0 \nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.native"..." type=io.containerd.snapshotter.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.overlayfs"..." type=io.containerd.snapshotter.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.zfs"..." type=io.containerd.snapshotter.v1 
time="2020-05-15T02:45:30Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.zfs" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter" 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.metadata.v1.bolt"..." type=io.containerd.metadata.v1 
time="2020-05-15T02:45:30Z" level=warning msg="could not use snapshotter btrfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" 
time="2020-05-15T02:45:30Z" level=warning msg="could not use snapshotter aufs in metadata plugin" error="modprobe aufs failed: "ip: can't find device 'aufs'\naufs                  217088  0 \nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
time="2020-05-15T02:45:30Z" level=warning msg="could not use snapshotter zfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter" 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.differ.v1.walking"..." type=io.containerd.differ.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.gc.v1.scheduler"..." type=io.containerd.gc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.containers-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.content-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.diff-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.images-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.leases-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.namespaces-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.snapshots-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.monitor.v1.cgroups"..." type=io.containerd.monitor.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.runtime.v1.linux"..." type=io.containerd.runtime.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.service.v1.tasks-service"..." type=io.containerd.service.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.containers"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.content"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.diff"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.events"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.healthcheck"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.images"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.leases"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.namespaces"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.snapshots"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.tasks"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.version"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." type=io.containerd.grpc.v1 
time="2020-05-15T02:45:30Z" level=info msg=serving... address="/var/run/docker/containerd/containerd-debug.sock" 
time="2020-05-15T02:45:30Z" level=info msg=serving... address="/var/run/docker/containerd/containerd.sock" 
time="2020-05-15T02:45:30Z" level=info msg="containerd successfully booted in 0.016871s" 
time="2020-05-15T02:45:30.432616773Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc4208eb390, READY" module=grpc
time="2020-05-15T02:45:30.435327930Z" level=info msg="parsed scheme: \"unix\"" module=grpc
time="2020-05-15T02:45:30.435350852Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2020-05-15T02:45:30.435995365Z" level=info msg="parsed scheme: \"unix\"" module=grpc
time="2020-05-15T02:45:30.436037517Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
time="2020-05-15T02:45:30.435455019Z" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}]" module=grpc
time="2020-05-15T02:45:30.436739709Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2020-05-15T02:45:30.436958738Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420a1e0e0, CONNECTING" module=grpc
time="2020-05-15T02:45:30.436701066Z" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}]" module=grpc
time="2020-05-15T02:45:30.437146504Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
time="2020-05-15T02:45:30.437221587Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420a1e0e0, READY" module=grpc
time="2020-05-15T02:45:30.437345521Z" level=info msg="blockingPicker: the picked transport is not ready, loop back to repick" module=grpc
time="2020-05-15T02:45:30.437362082Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420a74100, CONNECTING" module=grpc
time="2020-05-15T02:45:30.437752460Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420a74100, READY" module=grpc
time="2020-05-15T02:45:30.482210844Z" level=info msg="Graph migration to content-addressability took 0.00 seconds"
time="2020-05-15T02:45:30.482549094Z" level=warning msg="Your kernel does not support swap memory limit"
time="2020-05-15T02:45:30.482620892Z" level=warning msg="Your kernel does not support cgroup rt period"
time="2020-05-15T02:45:30.482639107Z" level=warning msg="Your kernel does not support cgroup rt runtime"
time="2020-05-15T02:45:30.483299744Z" level=info msg="Loading containers: start."
time="2020-05-15T02:45:30.497790780Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: ip: can't find device 'bridge'\nbridge                126976  1 br_netfilter\nstp                    16384  1 bridge\nllc                    16384  2 bridge,stp\nip: can't find device 'br_netfilter'\nbr_netfilter           24576  0 \nbridge                126976  1 br_netfilter\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n, error: exit status 1"
time="2020-05-15T02:45:30.503447172Z" level=warning msg="Running modprobe nf_nat failed with message: `ip: can't find device 'nf_nat'\nnf_nat_masquerade_ipv4    16384  1 ipt_MASQUERADE\nnf_nat_ipv4            16384  1 iptable_nat\nnf_nat                 24576  3 xt_nat,nf_nat_masquerade_ipv4,nf_nat_ipv4\nnf_conntrack          106496  7 ip_vs,nf_nat_masquerade_ipv4,nf_conntrack_netlink,nf_conntrack_ipv4,nf_nat_ipv4,xt_conntrack,nf_nat\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"
time="2020-05-15T02:45:30.510053834Z" level=warning msg="Running modprobe xt_conntrack failed with message: `ip: can't find device 'xt_conntrack'\nxt_conntrack           16384  9 \nx_tables               36864 12 xt_statistic,ipt_REJECT,iptable_mangle,xt_comment,xt_mark,xt_nat,xt_tcpudp,ipt_MASQUERADE,xt_addrtype,iptable_filter,ip_tables,xt_conntrack\nnf_conntrack          106496  7 ip_vs,nf_nat_masquerade_ipv4,nf_conntrack_netlink,nf_conntrack_ipv4,nf_nat_ipv4,xt_conntrack,nf_nat\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"
time="2020-05-15T02:45:30.557676435Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
time="2020-05-15T02:45:30.590036056Z" level=info msg="Loading containers: done."
time="2020-05-15T02:45:30.624425967Z" level=info msg="Docker daemon" commit=4d60db4 graphdriver(s)=overlay2 version=18.09.0
time="2020-05-15T02:45:30.624659576Z" level=info msg="Daemon has completed initialization"
time="2020-05-15T02:45:30.628516390Z" level=warning msg="Could not register builder git source: failed to find git binary: exec: \"git\": executable file not found in $PATH"
time="2020-05-15T02:45:30.643352495Z" level=info msg="API listen on /var/run/docker.sock"
Detected registry credentials
+ /usr/local/bin/docker version
Client: Docker Engine - Community
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:46:51 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:52:55 2018
  OS/Arch:          linux/amd64
  Experimental:     false
+ /usr/local/bin/docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.09.0
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.4.0-62-generic
Operating System: Alpine Linux v3.8 (containerized)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 62.87GiB
Name: 601d2a4a4e82
ID: 4E33:44VI:JPYE:5W5U:B72R:DUTY:TYRC:TGFU:PFF5:QRDH:5JJV:EJWK
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 git.xxx.com:5050
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
+ /usr/local/bin/docker build --rm=true -f Dockerfile -t 7e050636d9d3cef9bafcc6e79dd28a1865147ea5 . --pull=true --label org.label-schema.schema-version=1.0 --label org.label-schema.build-date=2020-05-15T02:45:32Z --label org.label-schema.vcs-ref=7e050636d9d3cef9bafcc6e79dd28a1865147ea5 --label org.label-schema.vcs-url=https://git.xxx.com/abc/abc-data-internal-api.git
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /drone/src/Dockerfile: no such file or directory
time="2020-05-15T02:45:32Z" level=fatal msg="exit status 1"

this is my .drone.yml

kind: pipeline
type: docker
name: default

trigger:
  event:
    - tag

volumes:
- name: cache
  host:
    path: /tmp/drone/${DRONE_REPO_NAME}

steps:
  - name: build
    image: plugins/docker
    settings:
      username: 
        from_secret: docker_username
      password:
        from_secret: docker_password
      repo: git.xxx.com:5050/abc/abc-data-internal-api
      registry: git.xxx.com:5050
      insecure: true
      autotag: true
      debug: true

this is a springboot project, and Dockerfile in the root path of project.
anyone could give any help?

lstat /drone/src/Dockerfile: no such file or directory

According to this error message, there is no Dockerfile in the root directory of your git repository. Are you sure a dockerfile exists for this particular commit sha? You could confirm this by adding a step to your pipeline:

steps:
- name: ls
  image: alpine
  commands:
  - ls -la
  - ls -la Dockerfile

I searched for this error on Google and it lead to StackOverflow. The top answers [1] confirm that this is caused by a missing Dockerfile, and actually has nothing to do with symlinks.

The error message is misleading. The problem has nothing to do with symlinks really. It is usually only that docker cannot find the Dockerfile describing the build.

[1] https://stackoverflow.com/questions/35511604/docker-unable-to-prepare-context-unable-to-evaluate-symlinks-in-dockerfile-pat#answer-57724377

i run into the same problem… even when i declare a dockerfile:

  docker-amd64:
    image: plugins/docker
    settings:
      repo: quay.io/xsteadfastx/hcloud-exporter
      pull: true
      username:
        from_secret: docker_username
      password:
        from_secret: docker_password
      dockerfile: docker/Dockerfile.linux.amd64
      auto_tag: true
      auto_tag_suffix: linux-amd64
    when:
      event: [push, tag]

thats pwd and ls in the build step before:

+ pwd
/srv/app/src/github.com/promhippie/hcloud_exporter
+ ls -la docker/
total 32
drwxr-xr-x  2 root root 4096 Dec  1 13:59 .
drwxr-xr-x 11 root root 4096 Dec  1 13:59 ..
-rw-r--r--  1 root root  531 Dec  1 13:59 Dockerfile.linux.amd64
-rw-r--r--  1 root root  531 Dec  1 13:59 Dockerfile.linux.arm32v6
-rw-r--r--  1 root root  531 Dec  1 13:59 Dockerfile.linux.arm32v7
-rw-r--r--  1 root root  531 Dec  1 13:59 Dockerfile.linux.arm64v8
-rw-r--r--  1 root root  529 Dec  1 13:59 Dockerfile.linux.i386
-rw-r--r--  1 root root  352 Dec  1 13:59 Dockerfile.windows.amd64

and there error in the drone docker plugin step:

+ /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock
Registry credentials or Docker config not provided. Guest mode enabled.
+ /usr/local/bin/docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:22:56 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 01:30:32 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
+ /usr/local/bin/docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: <unknown>
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
WARNING: No swap limit support
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.15.0-74-generic
 Operating System: Alpine Linux v3.11 (containerized)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.9GiB
 Name: f19b83f572d7
 ID: A3VH:XMK6:TTHG:YMTP:ENQU:U4C2:ALZZ:ENMK:4L74:SRCA:ZFF2:W3K3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

+ /usr/local/bin/docker build --rm=true -f Dockerfile -t 9b2862a9a2bd53df4faef71d8c9502f89170f8cb . --pull=true --label org.label-schema.schema-version=1.0 --label org.label-schema.build-date=2020-12-01T14:03:35Z --label org.label-schema.vcs-ref=9b2862a9a2bd53df4faef71d8c9502f89170f8cb --label org.label-schema.vcs-url=https://git.xsfx.dev/prometheus/hcloud_exporter.git
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /srv/app/src/github.com/promhippie/hcloud_exporter/Dockerfile: no such file or directory
time="2020-12-01T14:03:35Z" level=fatal msg="exit status 1"

The yaml file you provided is invalid. It is a mix between the 0.8 syntax and the 1.0 syntax and is not going to work properly. Please ensure you are using the correct syntax in your yaml file.

Also please note that the working directory for Drone steps is “/drone/src”. This means the docker plugin will look for the docker file at “/drone/src/docker/Dockerfile.linux.amd64” and the context of the docker build will be “/drone/src”.