docker attach connects your terminal to the main process of a running container, which is handy for game servers and other apps with a console. Getting out again is where people go wrong.
docker attach mc-server
Press Ctrl+C and your terminal sends SIGINT to the process in the container, because attach forwards signals by default. For most apps that means a shutdown. The polite way out is the detach sequence Ctrl+P followed by Ctrl+Q, which disconnects your terminal and leaves the process running.
That sequence only works when the container was started with -it, so it has a terminal and an open input. Without those, you can still attach safely with:
docker attach --sig-proxy=false mc-server
Now Ctrl+C only ends your attach session.
If Ctrl+P clashes with something you use, like shell history in an editor running inside the container, pick another sequence with --detach-keys, for example --detach-keys="ctrl-x,x". It also works on docker run and docker exec.
For simply reading output, I would use docker logs -f instead. It cannot send anything to the process, so there is nothing to get wrong.
Further reading: docker container attach