我有以下内容Dockerfile
:
FROM golang:1.9.2
ADD . /go/src/github.com/golang/example/outyet
ADD . /go/src/github.com/derekparker/delve/cmd/dlv
RUN go install github.com/golang/example/outyet
RUN go install github.com/derekparker/delve/cmd/dlv
RUN ["chmod", "+x", "/go/src/github.com/golang/example/outyet/bootstrap.sh"]
CMD ["/go/src/github.com/golang/example/outyet/bootstrap.sh"]
EXPOSE 8091
EXPOSE 5432
和以下bootstrap.sh
:
#!/bin/sh
go build -gcflags='-N -l' github.com/golang/example/outyet &&
dlv --listen=:5432 --headless=true --api-version=2 exec outyet;
使用以下行运行容器和映像后:
sudo docker build -t outyet .
sudo docker run -p 6060:8091 -p 5432:5432 --name test --rm outyet
我得到以下输出:
flag provided but not defined: -listen
Usage of dlv:
-http string
Listen address (default ":8091")
-poll duration
Poll period (default 1s)
-version string
Go version (default "1.4")
当我在我的 ubuntu 主机上本地运行 bootstrap.sh 时,一切正常。怎么了?