docker-compose: the down method doesn't appear to work

After having run the following command: await compose.upAll(composeOpts)

I run the following command:

await this.compose.down(composeOpts)

and he enclosing promise simply dies. I have wrapped this code in a try and it doesn’t catch any error. The execution just stops.

Is there an example of down being used somewhere? I can’t find any documentation on down or stop, and I am unable to manage my containers after creating them with this package.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Not sure if this is an issue (never tried this) but you’re using await and then together.

Technically this should not change much, await is basically a Generator wrapper around .then and .catch calls. Since .then returns a Promise, it should work exactly as we expect here.

I am unsure how to add more logging to this situation, or how to attach an output stream to this specific code. I won’t ask for your assistance in this area, but I do feel comfortable trying to follow an example of such being done with the source code for this project as I can now get the tests to run.

I’ve looked it up and apparently you can’t do that (attach the streams) atm. That’s because https://github.com/PDMLab/docker-compose/blob/dd4fe76eab0eddb273f5f4dc9981408588166095/src/index.ts#L167-L170 doesn’t allow passing other options to the spawned process 😕 I kinda assumed it was possible.

See child_process.spawn reference: https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options

We’re looking for stdio option.

I’ll have a look if we can patch this after work.

@Steveb-p the process doesn’t hang, it just “exits” that async method, almost as if the promise resolved, and continues executing the lines after “bringItDown” is called.

@AlexZeitler I cloned anew, yarn install and yarn test, and now the tests are being found and completed successfully. I will try to use the tests here to narrow down the cause of my issue.