generator-jhipster icon indicating copy to clipboard operation
generator-jhipster copied to clipboard

Does --remove-orphans need to be added back in to Docker commands?

Open mraible opened this issue 2 years ago • 6 comments

Overview of the issue

I upgraded my JHipster Native example today to use JHipster 7.8.1 from 7.7.0. One thing I noticed is --remove-orphans was dropped from the docker:db:down and docker:keycloak:down commands. See diff here.

Motivation for or Use Case

This change seem to be causing CI to fail.

Stopping docker_flickr2-postgresql_1 ... 
Stopping docker_flickr2-postgresql_1 ... done
Found orphan containers (docker_keycloak_1) for this project. If you removed or renamed this service in your compose file, 
you can run this command with the --remove-orphans flag to clean it up.
Removing docker_flickr2-postgresql_1 ... 
Removing docker_flickr2-postgresql_1 ... done
Removing network docker_default
error while removing network: network docker_default id cf8028a48d516c324933a87ced0b143335e2647cdd4245bec708131e4ec47df3 has active endpoints
Error: Process completed with exit code 1.

I'm not sure if it's related, but it seems like it might be.

mraible avatar Apr 15 '22 23:04 mraible

@mshima It looks like you made this change in 3a9f27d10444cd13fb37e03436db8b66f539afdc. Did you also make adjustments to the ci-cd sub-generator so orphan containers are cleaned up?

mraible avatar Apr 16 '22 03:04 mraible

If we remove orphans log dump won’t work https://github.com/jhipster/generator-jhipster/blob/7fe3ca987f499407e4581a2de20ce6c4cfbbdb9a/.github/workflows/angular.yml#L224

Environments like GitHub actions doesn’t need the teardown, that step can be removed. Environments that need the cleanup, it’s easy to add.

If the user runs the command in a shared environment, it can remove some logs and old docker files system that wasn’t supposed to remove.

Keeping —remove-orphans out is the safest, but will rarely make a difference.

mshima avatar Apr 16 '22 08:04 mshima

OK, I'll merge my updates to the JHipster Native blog post/example and hope for the best when updating my (currently in draft) GitHub Actions for GraalVM post.

mraible avatar Apr 16 '22 16:04 mraible

@mshima When updating and testing my GitHub Actions for GraalVM post, I ran into this issue again. I'll add a note to the post that you need to add --remove-orphans back in for things to work.

mraible avatar Apr 17 '22 23:04 mraible

I'm reopening this because it happens consistently enough that it's annoying.

I vote that we restore the previous behavior in the spirit of developer experience: it should work on the first try.

mraible avatar Apr 21 '22 03:04 mraible

I did research some days ago and I think the only alternative is to start/stop every docker image at once. We should revert and we may try removing it for v8.

mshima avatar Apr 21 '22 08:04 mshima

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days

github-actions[bot] avatar Dec 04 '23 00:12 github-actions[bot]