progressbar
progressbar copied to clipboard
docker logs -f does not show progress bar
When trying to follow docker container logs with "docker logs container -f" the progress bar is not showing even though by default it's following StdOut and the progress bar is writing to os.Stdout
main.go
package main
import (
"time"
"github.com/schollz/progressbar/v3"
)
func main() {
bar := progressbar.Default(100)
for i := 0; i < 100; i++ {
bar.Add(1)
time.Sleep(1 * time.Second)
}
}
Dockerfile
FROM golang:1.18-alpine
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY *.go ./
RUN go build -o /application
CMD [ "/application" ]
Building:
docker build -t app .
Running:
docker run -d -t app
Follow logs:
docker logs 0b26e53d7321 -f
same with you.
same
you can try changing the command. please check out my solution: https://github.com/schollz/progressbar/issues/64#issuecomment-2226858924