Reputation: 2258
Using docker compose
I've created a container for my MySQL DB and one for my Python script. When I use the command docker compose up
, my images are built for my Python app container and my MySQL DB container, and the python script is run. After execution, the shell just hangs since MySQL server is still running and my script has completed execution. How can I either stop the MySQL server after my script runs, or re-run my script while the MySQL server continues to run?
Upvotes: 0
Views: 216
Reputation: 1431
When running docker-compose up
, your current shell will display all the logs from all the containers defined in the docker-compose.yaml
file. Also if you terminate the command with cmd + c
in MacOS, all the containers will stop running.
As a result, this gives you the impression that the shell just hangs while everything is still running as normal.
What you want in this case is to let the containers continue to run in the background (detached mode)
docker-compose up --detach
The MySQL server will now continue to run until you stop it with docker-compose down
.
Upvotes: 1