skip to Main Content

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


  1. You can redirect output of the command to file and runn it in the background.

    docker-compose up &> out.log &
    

    You are free to use your terminal and if you the want to read the output just tail the file.

    tail -f out.log 
    
    Login or Signup to reply.
  2. If you run compose in detached mode (docker-compose up -d) then you can see logs from services by running docker-compose logs -f. -f flag means that new logs will be shown further.

    See the documentation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search