Dallas Caley
Dallas Caley

Reputation: 5848

How to reconnect to docker-compose output log?

Please help, I'm not even sure if I am asking the right question here as there are many new components to my environment (the new components of my Environment are that I am new to developing in a Windows OS, New to Visual Studio Code IDE, and new to Docker within VS Code. This question could pertain to any of those factors.

Scenario:

I boot up my windows 10 machine, open VS Code, go to the command line from within VS Code (I am using a Git Bash Shell within VS Code). From this terminal I start my project with the following command: docker-compose up --build

as a result of running this command, I see the output in my terminal which indicates that all three of my containers have started up (Note this is a Flask application using Postgres with an Angular front end, each one has it's own container).

My application has a test API endpoint which when called responds with 'status ok'. Upon hitting that endpoint in postman I see a couple of lines of output in my terminal indicating that the application has processed the request for the specific URL. Everything is great.

Now I close all my applications and reboot the machine.

Upon rebooting I see a message from the system informing me that my docker containers are starting. This is good. But now I would like to get back to the state where I can see that same output that I saw when I ran the docker-compose up command, however this is no longer in the terminal on VS Code.

My question is, how can I get that output again without shutting down the docker containers and re-building them? Sure, I could do that, but this seems like an unnecessary step since the containers auto-restarted on system reboot.

Is there a log I can tail?

Additional info:

In the DockerFile for the API server. The server is started with the following command:

CMD ["./entrypoint.local.sh"]

In the entrypoint.local.sh file, the actual application is started with this command:

uwsgi --ini /etc/uwsgi.local.ini --chdir /var/www/my-application

Final note: This is not an application I created so I would like to avoid changing it since this will affect others on my team

Upvotes: 4

Views: 1286

Answers (1)

Guillermo Maschwitz
Guillermo Maschwitz

Reputation: 1106

In your terminal run: docker-compose logs --follow <name-of-your-service>

Or see every log stream for every service with docker-compose logs --follow

You can find the name of your docker-compose service by looking at each key under services: in your docker-compose.yml

Upvotes: 6

Related Questions