Skip to content

Isolating logs for an individual container? #270

Answered by cristianrgreco
theogravity asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @theogravity, you cannot get logs from a single container using the DEBUG environment variable as the container IDs and names are random, but you can get the logs of a container at runtime by running:

const container = await new GenericContainer("alpine")
  .start();

const stream = await container.logs();
stream
    .on("data", line => console.log(line))
    .on("err", line => console.error(line))
    .on("end", () => console.log("Stream closed"));

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cristianrgreco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants