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

CLI must check if all containers started properly #3655

Closed
riuvshin opened this issue Jan 10, 2017 · 4 comments
Closed

CLI must check if all containers started properly #3655

riuvshin opened this issue Jan 10, 2017 · 4 comments
Assignees
Labels
kind/enhancement A feature request - must adhere to the feature request template. severity/P1 Has a major impact to usage or development of the system.
Milestone

Comments

@riuvshin
Copy link
Contributor

riuvshin commented Jan 10, 2017

today CLI checks only is api server is available, but sometimes some containers may not start this usually happen due to docker bugs like after docker engine restart some container unable to start and the only way to make it work remove stopped container and restart. There is a lot of other possible scenarios where some container may not start so we must check every single container is it at least running container.

here is command how to do that check with inspect this command return true or false
docker inspect -f {{.State.Running}} $CONTAINER_ID

so all we neeed to do is to iterate across all codenvy containers and check if all is in running state.

here is a command how to get all existed (even stopped) codenvy containers:
docker ps -qa --filter="name=codenvy_*"

but that approach could be better if we will find a way how to do that check by container name because I think we could have situation where container was not created so we will not have container id to check. (Im not sure if that situation is possible)

@riuvshin riuvshin added the kind/enhancement A feature request - must adhere to the feature request template. label Jan 10, 2017
@riuvshin riuvshin added this to the 5.1.0 milestone Jan 10, 2017
@bmicklea bmicklea removed this from the 5.1.0 milestone Jan 10, 2017
@bmicklea bmicklea added the severity/P1 Has a major impact to usage or development of the system. label Jan 10, 2017
@riuvshin
Copy link
Contributor Author

riuvshin commented Jan 10, 2017

So I think algorithm should be like that:

for each image from images file do:

  1. get container_id=$(docker ps -aq --filter=ancestor=$IMAGE_NAME)
  2. do check is $container_id is not empty, if it is empty we fail which means container didn't started due to some reason
  3. do check is container running docker inspect -f {{.State.Running}} $container_id we ok if this return true, fail if false.

@benoitf wdyt?

@benoitf
Copy link
Contributor

benoitf commented Jan 10, 2017

yeah I've understood the goal

@benoitf benoitf added the status/open-for-dev An issue has had its specification reviewed and confirmed. Waiting for an engineer to take it. label Jan 12, 2017
@benoitf
Copy link
Contributor

benoitf commented Jan 12, 2017

@riuvshin
so after analyzing the issue I think your issue is only when docker compose is not able to be started the first time.
If docker compose successfully starts, then it is automatically restarting the containers
and if che doesn't boot in the given amount of time, then we exit with an error

so I think we only need to check docker compose boot sequence. For now if there is a failure it silently exits

benoitf added a commit that referenced this issue Jan 13, 2017
…ose up command and also check each container of docker-compose services if they’re running or not

Change-Id: Ie7ef9cc301c2605ec40db70f00d06f1fca694e4c
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
@benoitf benoitf added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. and removed status/open-for-dev An issue has had its specification reviewed and confirmed. Waiting for an engineer to take it. labels Jan 13, 2017
@benoitf
Copy link
Contributor

benoitf commented Jan 13, 2017

#3731

benoitf added a commit that referenced this issue Jan 16, 2017
…er-compose up command and also check each container of docker-compose services if they’re running or not

Change-Id: I91f0298aaaa3c547925989f964a8d2c38f6393d3
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Jan 17, 2017
@benoitf benoitf added this to the 5.1.0 milestone Jan 17, 2017
JPinkney pushed a commit to JPinkney/che that referenced this issue Aug 17, 2017
…lt of docker-compose up and containers (eclipse-che#3731)

* Fix eclipse-che#3655 : Check docker-compose file validity, result of docker-compose up command and also check each container of docker-compose services if they’re running or not

Change-Id: Ie7ef9cc301c2605ec40db70f00d06f1fca694e4c
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>

* fixup! Fix eclipse-che#3655 : Check docker-compose file validity, result of docker-compose up command and also check each container of docker-compose services if they’re running or not

Change-Id: I91f0298aaaa3c547925989f964a8d2c38f6393d3
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

3 participants