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

[FEATURE REQUEST] Running container in foreground #54

Open
hron84 opened this issue May 21, 2020 · 3 comments
Open

[FEATURE REQUEST] Running container in foreground #54

hron84 opened this issue May 21, 2020 · 3 comments

Comments

@hron84
Copy link

hron84 commented May 21, 2020

Currently, poco up plan always start containers behind the scenes. In some cases it would be more useful, if the container could be started in foreground, like how the docker-compose up works.

@sarkiroka
Copy link
Contributor

@hron84
Could you give one or more specific example(s) of where this would be useful?

@hron84
Copy link
Author

hron84 commented Jun 22, 2020

I currently have a Git repository with Nagios configuration files and I use docker-compose to create a Nagios container with same version as the production and check the configuration files (I don't want to actually run a Nagios server, since it's not neccessary and could not work because a whole different networking conditions. I just want to check configuration files from syntax, and dependency aspect).

The docker-compose.yml:

version: "3.7"

services:
  nagios:
    image: jasonrivers/nagios:latest
    volumes:
      - .:/opt/nagios/etc/
    command: /opt/nagios/bin/nagios -v /opt/nagios/etc/nagios.cfg

After starting the tests, Nagios runs a few checks and exits. If the Nagios encounter any problems it logs to the standard output/standard error streams. But since I cannot see immediately the output of the output of the container, I lose the information about why the tests are failed. Running poco log after starting not helps, these tests are very quick and the container become stopped right after that, poco log mosty displays nothing/errors from this.

I know there is a workaround for this problem but since docker-compose itself already supports running multiple containers in the foreground I just can't see why PoCo cannot do the same.

@sarkiroka
Copy link
Contributor

sarkiroka commented Jun 22, 2020

Ah, I see. But you know, the docker holds the log after the container exited too. When you have an exited (or running) container, you can get the previous logs by docker logs your_container command.
And if you use -f option for logs (follow log output) then log printed continously, except if container exited. This case -f option give back the prompt immediately.

So, you can use this command to check your nagios configuration:
poco up && docker logs your_container -f

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