Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way to see started containers and finer grained logging #120

Closed
cristianrgreco opened this issue Sep 13, 2020 · 2 comments
Closed

Add way to see started containers and finer grained logging #120

cristianrgreco opened this issue Sep 13, 2020 · 2 comments

Comments

@cristianrgreco
Copy link

cristianrgreco commented Sep 13, 2020

Hi, thanks for providing this great library! I'm incorporating it into https://github.com/testcontainers/testcontainers-node and it works great, I just have a couple of questions:

  1. Is there a way to get only the containers started by a given docker-compose - perhaps an array of container IDs?
  2. Is there a way to see if docker-compose up will pull an image? I'd like to provide some more logging around this so users see what's causing a delay. I know docker-compose can expose all the logs but I'd like more fine grained control instead of logging everything
@cristianrgreco cristianrgreco changed the title Add way to see started containers Add way to see started containers and finer grained logging Sep 13, 2020
@AlexZeitler
Copy link
Contributor

@cristianrgreco Hi! Happy to see docker-compose is actively being used. I’m afraid, apart from parsing the output there’s no structured data available from docker-compose(the CLI itself)

@cristianrgreco
Copy link
Author

cristianrgreco commented Sep 14, 2020

Sure no worries, thanks for the response.

For anyone else for the first point, I found that I can set COMPOSE_PROJECT_NAME as an env variable which will set the com.docker.compose.project label for all the resources which you can filter on later:

await dockerCompose.upAll({
  env: {
    ...process.env,
    COMPOSE_PROJECT_NAME: `my-project-name`,
  }
});

Running docker inspect on one of the containers shows the following label:

"com.docker.compose.project": "my-project-name"

So you could get all running containers and filter by the label specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants