progressbar icon indicating copy to clipboard operation
progressbar copied to clipboard

docker logs -f does not show progress bar

Open Marijus opened this issue 2 years ago • 3 comments

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

Marijus avatar Dec 06 '22 13:12 Marijus

same with you.

oldwang12 avatar Mar 21 '24 08:03 oldwang12

same

caozhuozi avatar Jun 17 '24 05:06 caozhuozi

you can try changing the command. please check out my solution: https://github.com/schollz/progressbar/issues/64#issuecomment-2226858924

twkevinzhang avatar Jul 13 '24 15:07 twkevinzhang