我正在尝试在我的 docker 容器中安装 delve 以调试 Go 应用程序。
在我的 Dockerfile 中,我输入:
RUN go get github.com/go-delve/delve/cmd/dlv
但是当我进入 docker 容器并运行时dlv它说
bash: dlv: command not found
go get github.com/go-delve/delve/cmd/dlv我尝试通过直接在容器中运行来手动安装它。它结束时没有输出。但我仍然遇到相同的“找不到命令”错误
看起来它根本没有安装 delve。这是我的环境变量和容器内的 Go bin 目录:
root@5d8aef1f6721:/my/project# printenv | grep GO
GOFLAGS=-mod=vendor
GOLANG_VERSION=1.19.1
GOROOT=/usr/local/go
GOPATH=/go
root@5d8aef1f6721:/my/project# printenv | grep PATH
PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
GOPATH=/go
root@5d8aef1f6721:/my/project# ls -la /go/bin
total 23540
drwxrwxrwx 1 root root 4096 Sep 20 10:29 .
drwxrwxrwx 1 root root 4096 Sep 20 10:28 ..
-rwxr-xr-x 1 root root 24085739 Sep 20 10:29 saml
root@5d8aef1f6721:/my/project# ls -la /usr/local/go/bin
total 17456
drwxr-xr-x 2 root root 4096 Aug 31 17:40 .
drwxr-xr-x 10 root root 4096 Aug 31 17:40 ..
-rwxr-xr-x 1 root root 14520630 Aug 31 17:40 go
-rwxr-xr-x 1 root root 3340906 Aug 31 17:40 gofmt
我很困惑为什么它没有安装...知道吗?
一只萌萌小番薯
相关分类