Forrest logo
back to the docker tool

docker:tldr:c55e1

docker: Follow logs for a specific container.
$ docker compose logs --follow ${container_name}
try on your machine

The command "docker compose logs --follow ${container_name}" is used to show the logs of a specific container in a Docker Compose project and continually monitor them in real-time.

Here's a breakdown of this command:

  • "docker compose" is the command-line interface for managing Docker Compose projects.
  • "logs" is a sub-command that allows you to view the logs of containers in the project.
  • "--follow" is an option that indicates that you want to continuously monitor the logs as they are generated.
  • "${container_name}" is a placeholder for the name of the specific container you want to see the logs for.

You need to replace "${container_name}" with the actual name of the container you want to monitor. This specific command will retrieve the logs for that container and display them in your terminal in real-time. Any new log entries that the container generates will continuously be printed on the console until you stop the process (usually with Ctrl+C).

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool