for docker run to exit out of the docker container bash shell. Just run exit or hit ctrl + D
for docker-compose you use ctrl + c
remember to use docker ps to check the status of your container and docker stop <container name> to actually stop the container
I hope this helps.
Thanks Ben, but typing exit and ctrl + D when an error caused by docker run did not get me out of the error.
I had to kill the terminal tab or terminal window.