-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker 版本日志无法输出到文件 #1027
Labels
bug
Something isn't working
Comments
Show your config file nps.conf 看看配置文件 |
|
问题我认为是dockerfile的原因,dockerfile 没有一个启动参数。
dockerfile CMD
修改一下启动命令重新打包镜像 挂载log volumn就可以了 |
我编译了一个 测试了一下没有问题 docker run -d --name nps-as --net=host -v /root/nps/conf/:/conf -v /var/log/nps/:/logs aschenmaker/nps:v0.0.1 conf/nps.conf
日志 tail -f /var/log/nps/nps.log dockerfile FROM golang:1.15 as builder
ARG GOPROXY="https://goproxy.cn,direct"
WORKDIR /go/src/ehang.io/nps
COPY . .
RUN go get -d -v ./...
RUN CGO_ENABLED=0 go build -ldflags="-w -s -extldflags -static" ./cmd/nps/nps.go
FROM scratch
COPY --from=builder /go/src/ehang.io/nps/nps /
COPY --from=builder /go/src/ehang.io/nps/web /web
VOLUME /conf
CMD ["/nps", "service"]
|
Jireh012
added a commit
to Jireh012/nps
that referenced
this issue
Aug 9, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
docker 版本日志无法输出到文件
https://hub.docker.com/r/ffdfgdfg/nps
日志仅能通过
docker logs
命令查看, 无法输出到文件。尝试过如下方式均无法获取:
sudo docker cp nps:/var/log/nps.log nps.log
=> No such container:path: nps:/var/log/nps.logThe text was updated successfully, but these errors were encountered: