Isolating logs for an individual container? #270
Answered
by
cristianrgreco
theogravity
asked this question in
Q&A
-
I'm working with a tool that spins up a lot of containers from various services using this library. Is there a way to only get log output from a specific container vs all of them? |
Beta Was this translation helpful? Give feedback.
Answered by
cristianrgreco
Sep 8, 2021
Replies: 1 comment
-
Hi @theogravity, you cannot get logs from a single container using the 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")); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
cristianrgreco
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: