Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Open separate terminal logs/output for all services – Docker Compose

I am running a web app with docker-compose with a React frontend and FastAPI (Python) backend.

I am trying to get the output for both services on different terminals (they are currently outputting to the same terminal), are there any changes I can make to docker-compose.yml to achieve this?

Docker Compose File:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

version: '3.8'

services:
  dockerengine:
    build: ./backend
    volumes:
      - ./backend/src:/src
    ports:
      - 8000:8000
    network_mode: host
    stdin_open: true
    tty: true  
  
  dockerui:
    build: ./frontend
    volumes:
      - ./frontend/src:/src
    ports:
      - 3000:3000
    network_mode: host
    stdin_open: true
    tty: true

Image showing both services outputting to the same terminal:
enter image description here

>Solution :

Just open couple of terminals and enter the logs command:

docker-compose logs -f service_name

In your case:

# in a terminal
docker-compose logs -f dockerengine
# in another terminal
docker-compose logs -f dockerui
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading