Interview Prep/Docker/Containers, VMs & Isolation Internals

What is the difference between `docker exec` and `docker attach`?

BeginnerConceptContainers, VMs & Isolation Internals
Answer

exec starts a new process inside a running container (e.g. docker exec -it web sh); exiting it does not affect the container. attach connects your terminal to the container's existing PID 1 stdio; Ctrl-C may stop the container unless you use --sig-proxy=false and detach with Ctrl-P Ctrl-Q.

All Docker questions Roadmap: Docker & containers

More on Containers, VMs & Isolation Internals