If I run docker-compose up
, my terminal is taken over by the docker logs.
If I run that in detached mode i.e. docker-compose up -d
, I get to keep my terminal.
Is it possible to go from detached mode to log mode?
Likewise, is it possible to go from log mode to detached mode? (I only know that you can stop log mode by pressing Ctrl + C twice.)
2
Answers
You can redirect output of the command to file and runn it in the background.
You are free to use your terminal and if you the want to read the output just tail the file.
If you run compose in detached mode (
docker-compose up -d
) then you can see logs from services by runningdocker-compose logs -f
.-f
flag means that new logs will be shown further.See the documentation.