after docker-compose up, on windows i quit that with "CTRL+C" and the container(s) are still running. When i do this on my mac, then docker kills my container :(
I tried it now with a shell script, which executes the docker-compose up into "echo", but on some container, the scripts hang up.
How do you do that? Are there any best practices? (suitable with windows)
Thanks a lot.
To prevent Compose from picking up changes, use the --no-recreate flag. If you want to force Compose to stop and recreate all containers, use the --force-recreate flag. If the process encounters an error, the exit code for this command is 1 .
Starting and Stopping Docker Compose You can stop it using CTRL+C (run once for the preferable graceful shutdown, or twice to force-kill). You can start Docker Compose in the background using the command docker-compose up -d . If using this method, you'll need to run docker-compose stop to shut it down.
Options. Remove containers for services not defined in the Compose file. Remove named volumes declared in the volumes section of the Compose file and anonymous volumes attached to containers.
To exit out of the docker container bash shell. Just run exit or hit ctrl-D like you normally would.
If you want to run docker-compose up
and leave the process running without being attached to your terminal, you can run it in detached mode with docker-compose up -d
.
https://docs.docker.com/compose/reference/up/
After doing so, you'd have to use docker-compose stop
or docker-compose down
to stop your running containers, since CTRL+C
won't kill them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With