Restarting docker containers without breaking pycharm

At work, we use pycharm to run our project in docker containers.

On my machine, I added an alias to my shell called "rebuild" that looks like this:

cd ~/Documents/project_dir/; docker compose down; docker-compose up --build -d; docker-compose exec django ./manage.py migrate --noinput'

Running "rebuild" in my shell now works great, but if I do this while pycharm is running, pycharm gets confused. It stops being able to run containers, or debug, until I restart pycharm. I think this shuts down pycharm helper docker containers or something.

Does anyone know why this breaks pycharm? Is there something I can do to not break pycharm when I do this? Or at least to tell Pycharm from the command line to recreate its containers or restart or something?

Note: Yes, this restarts all containers, even ones that haven't been rebuilt. There's a more efficient way to do this, where it only restarts rebuilt containers. I'd rather restart all of them.

PS: Using PyCharm 2022.2.1

Please sign in to leave a comment.