我在 alpine:3.7.1 容器中运行 dlv。它因此错误而崩溃:/ # /dlv --listen=:40000 --headless=true --api-version=2 exec /serverCould not create config directory: user: Current not implemented on linux/amd64.panic: runtime error: invalid memory address or nil pointer dereference[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x8c7dca]goroutine 1 [running]:github.com/derekparker/delve/cmd/dlv/cmds.execute(0x0, 0xc420057a00, 0x1, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0) /go/src/github.com/derekparker/delve/cmd/dlv/cmds/commands.go:575 +0x3aagithub.com/derekparker/delve/cmd/dlv/cmds.New.func4(0xc42014a000, 0xc420057a00, 0x1, 0x4) /go/src/github.com/derekparker/delve/cmd/dlv/cmds/commands.go:182 +0x65github.com/derekparker/delve/vendor/github.com/spf13/cobra.(*Command).execute(0xc42014a000, 0xc42001c6c0, 0x4, 0x6, 0xc42014a000, 0xc42001c6c0) /go/src/github.com/derekparker/delve/vendor/github.com/spf13/cobra/command.go:647 +0x237github.com/derekparker/delve/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200d1680, 0xc4200d1d40, 0xc4200d1b00, 0xc4200d18c0) /go/src/github.com/derekparker/delve/vendor/github.com/spf13/cobra/command.go:733 +0x2d4github.com/derekparker/delve/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200d1680, 0xc4200d1680, 0x9fad07) /go/src/github.com/derekparker/delve/vendor/github.com/spf13/cobra/command.go:692 +0x2bmain.main() /go/src/github.com/derekparker/delve/cmd/dlv/main.go:24 +0xe4我的文件:# Compile stageFROM golang:1.10.1-alpine3.7 AS build-envENV CGO_ENABLED 0ADD . /go/src/hello# The -gcflags "all=-N -l" flag helps us get a better debug experience#RUN go build -x -gcflags "all=-N -l" -o /server helloRUN go build -gcflags "all=-N -l" -o /server hello# Compile DelveRUN apk add --no-cache gitRUN go get github.com/derekparker/delve/cmd/dlv
1 回答
繁花不似锦
TA贡献1851条经验 获得超4个赞
如果我改变
FROM golang:1.10.1-alpine3.7 AS build-env
到
FROM golang:1.10-alpine3.7 AS build-env
/dlv 开始正常工作并且不再崩溃。
我认为此更改可确保构建容器与运行时容器相同。
- 1 回答
- 0 关注
- 85 浏览
添加回答
举报
0/150
提交
取消