Docker output of exec command in detach mode

4.3k views Asked by At

I'm trying to start a jar file inside a running container. In order to do this I use this command docker exec -t -d [containerID] java -jar jarname.jar. The command is successfully executed but I am unable to see its output. Docker allocates a new tty in the host but how can I see its output? What am I doing wrong?

1

There are 1 answers

12
Bryan On

How about removing the -d flag, then you will get the output on stdout.

Can use shell redirection and backgrounding on the docker command if needed.

I would also remove the '-t' flag unless your Java program specifically needs a tty.