Exec and Attach
docker exec
Run a command in a running container:
Learning Objectives
Lesson Outline
Run a command in a running container:
Attach to container's main process (PID 1):
| exec | attach |
|---|---|
| Creates new process | Connects to main process |
| Multiple sessions possible | Single session to PID 1 |
| Exit doesn't stop container | Exit may stop container |
| Use for debugging | Use for interactive apps |