Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker output of exec command in detach mode

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?

like image 710
user2419952 Avatar asked Aug 31 '25 16:08

user2419952


1 Answers

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.

like image 171
Bryan Avatar answered Sep 02 '25 15:09

Bryan