You can connect also to the stopped container. That is a general docker thing. You can try this article or google something else
https://www.thorsten-hans.com/how-to-run-commands-in-stopped-docker-containers/